Skip to content

Commit

Permalink
Manual rebase against master 0c69581 to assure converter and nexus co…
Browse files Browse the repository at this point in the history
…de is the same as 0c69581 master, it now is
  • Loading branch information
atomprobe-tc committed Dec 7, 2023
1 parent 013c59c commit cb17fde
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pynxtools/dataconverter/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@
if sys.version_info >= (3, 10):
from importlib.metadata import entry_points
else:
from importlib_metadata import entry_points
try:
from importlib_metadata import entry_points
except ImportError:
# If importlib_metadata is not present
# we provide a dummy function just returning an empty list.
# pylint: disable=W0613
def entry_points(group):
"""Dummy function for importlib_metadata"""
return []


logger = logging.getLogger(__name__) # pylint: disable=C0103
Expand All @@ -59,7 +67,7 @@ def get_reader(reader_name) -> BaseReader:
importlib_module = entry_points(group='pynxtools.reader')
if (
importlib_module
and reader_name in map(lambda ep: ep.name, entry_points(group='pynxtools.reader'))
and reader_name in map(lambda ep: ep.name, importlib_module)
):
return importlib_module[reader_name].load()
raise ValueError(f"The reader, {reader_name}, was not found.") from exc
Expand Down

0 comments on commit cb17fde

Please sign in to comment.