Skip to content

Commit

Permalink
Proper version switch for importlib_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Nov 28, 2023
1 parent 812b566 commit c15ce42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.10
- name: Install dependencies
run: |
git submodule sync --recursive
Expand Down
4 changes: 1 addition & 3 deletions pynxtools/dataconverter/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from pynxtools.dataconverter.template import Template
from pynxtools.nexus import nexus

if sys.version_info.major >= 3 and sys.version_info.minor > 9:
if sys.version_info >= (3, 10):
from importlib.metadata import entry_points
else:
from importlib_metadata import entry_points
Expand All @@ -59,7 +59,6 @@ def get_reader(reader_name) -> BaseReader:
importlib_module = entry_points(group='pynxtools.reader')
if (
importlib_module
# pylint: disable=unexpected-keyword-arg
and reader_name in map(lambda ep: ep.name, entry_points(group='pynxtools.reader'))
):
return importlib_module[reader_name].load()
Expand All @@ -77,7 +76,6 @@ def get_names_of_all_readers() -> List[str]:
index_of_readers_folder_name = file.rindex(f"readers{os.sep}") + len(f"readers{os.sep}")
index_of_last_path_sep = file.rindex(os.sep)
all_readers.append(file[index_of_readers_folder_name:index_of_last_path_sep])
# pylint: disable=unexpected-keyword-arg
plugins = list(map(lambda ep: ep.name, entry_points(group='pynxtools.reader')))
return all_readers + plugins

Expand Down

0 comments on commit c15ce42

Please sign in to comment.