Skip to content

Commit

Permalink
try importlib.metadata as alternative to pkg_resources; close #67
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Mar 4, 2024
1 parent f31c3bf commit f9e872d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 8 additions & 6 deletions eido/conversion.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import inspect
import sys
import os
if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
import inspect
from logging import getLogger

from pkg_resources import iter_entry_points
import os
from typing import NoReturn

from .exceptions import *
from typing import NoReturn

_LOGGER = getLogger(__name__)

Expand All @@ -21,7 +23,7 @@ def pep_conversion_plugins():
:raise EidoFilterError: if any of the filters has an invalid signature.
"""
plugins = {}
for ep in iter_entry_points("pep.filters"):
for ep in entry_points(group="pep.filters"):
plugin_fun = ep.load()
if len(list(inspect.signature(plugin_fun).parameters)) != 2:
raise EidoFilterError(
Expand Down
15 changes: 9 additions & 6 deletions eido/conversion_plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" built-in PEP filters """

from typing import Dict
from .output_formatters import MultilineOutputFormatter

Expand Down Expand Up @@ -73,10 +74,12 @@ def processed_pep_filter(p, **kwargs) -> Dict[str, str]:

return {
"project": str(prj_repr),
"samples": str(p.samples)
if samples_as_objects
else str(p.sample_table.to_csv()),
"subsamples": str(p.subsamples)
if subsamples_as_objects
else str(p.subsample_table.to_csv()),
"samples": (
str(p.samples) if samples_as_objects else str(p.sample_table.to_csv())
),
"subsamples": (
str(p.subsamples)
if subsamples_as_objects
else str(p.subsample_table.to_csv())
),
}

0 comments on commit f9e872d

Please sign in to comment.