Skip to content

Commit

Permalink
Merge branch 'main' into yoda_inf_support
Browse files Browse the repository at this point in the history
  • Loading branch information
20DM committed Mar 11, 2024
2 parents 76a3b19 + 1e5b10f commit dce72c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion hepdata_converter/parsers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pkgutil
import inspect
from importlib.util import module_from_spec


class BadFormat(Exception):
Expand Down Expand Up @@ -175,7 +176,9 @@ def parse(self, data_in, *args, **kwargs):

# import all packages in the parsers package, so that Parser.get_specific_parser will recognise them
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(name).load_module(name)
spec = loader.find_spec(name)
module = module_from_spec(spec)
spec.loader.exec_module(module)

for name, value in inspect.getmembers(module):
if name.startswith('__'):
Expand Down
5 changes: 4 additions & 1 deletion hepdata_converter/writers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
__all__ = []

import abc
from importlib.util import module_from_spec


class Writer(GetConcreteSubclassMixin, OptionInitMixin, metaclass=abc.ABCMeta):
Expand Down Expand Up @@ -36,7 +37,9 @@ def write(self, data_in, data_out, *args, **kwargs):

# import all packages in the parsers package, so that Writer.get_specific_writer will recognise them
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(name).load_module(name)
spec = loader.find_spec(name)
module = module_from_spec(spec)
spec.loader.exec_module(module)

for name, value in inspect.getmembers(module):
if name.startswith('__'):
Expand Down

0 comments on commit dce72c0

Please sign in to comment.