Skip to content

Commit

Permalink
🐛 fix lazy module finder duty
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Feb 1, 2024
1 parent 84c22eb commit 525fcbd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions githubkit/lazy_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,13 @@ def find_spec(
path: Optional[Sequence[str]],
target: Optional[ModuleType] = None,
) -> Optional[ModuleSpec]:
module_spec = PathFinder.find_spec(fullname, path, target)
if not module_spec or not module_spec.origin:
return module_spec
if any(re.match(pattern, fullname) for pattern in LAZY_MODULES):
module_spec = PathFinder.find_spec(fullname, path, target)
if not module_spec or not module_spec.origin:
return

Check warning on line 112 in githubkit/lazy_module.py

View check run for this annotation

Codecov / codecov/patch

githubkit/lazy_module.py#L112

Added line #L112 was not covered by tests

if module_spec and any(
re.match(pattern, module_spec.name) for pattern in LAZY_MODULES
):
module_spec.loader = LazyModuleLoader(module_spec.name, module_spec.origin)
return module_spec
return module_spec


def apply():
Expand Down

0 comments on commit 525fcbd

Please sign in to comment.