Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions snscrape/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import pkgutil
import importlib


__all__ = []


def _import_modules():
prefixLen = len(__name__) + 1
for importer, moduleName, isPkg in pkgutil.iter_modules(__path__, prefix = f'{__name__}.'):
assert not isPkg
moduleNameWithoutPrefix = moduleName[prefixLen:]
__all__.append(moduleNameWithoutPrefix)
module = importer.find_module(moduleName).load_module(moduleName)
globals()[moduleNameWithoutPrefix] = module
prefixLen = len(__name__) + 1
for importer, moduleName, isPkg in pkgutil.iter_modules(__path__, prefix=f'{__name__}.'):
assert not isPkg
moduleNameWithoutPrefix = moduleName[prefixLen:]
__all__.append(moduleNameWithoutPrefix)
module = importlib.import_module(moduleName)
globals()[moduleNameWithoutPrefix] = module


_import_modules()