Skip to content

Commit

Permalink
Use a tuple for processed parameter to facilitate future caching (pyl…
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost authored Aug 27, 2024
1 parent 16990fc commit a389ef7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, path: Sequence[str] | None = None) -> None:
def find_module(
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> ModuleSpec | None:
"""Find the given module.
Expand Down Expand Up @@ -130,7 +130,7 @@ class ImportlibFinder(Finder):
def find_module(
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> ModuleSpec | None:
if submodule_path is not None:
Expand Down Expand Up @@ -225,7 +225,7 @@ class ExplicitNamespacePackageFinder(ImportlibFinder):
def find_module(
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> ModuleSpec | None:
if processed:
Expand Down Expand Up @@ -265,7 +265,7 @@ def __init__(self, path: Sequence[str]) -> None:
def find_module(
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> ModuleSpec | None:
try:
Expand All @@ -289,7 +289,7 @@ class PathSpecFinder(Finder):
def find_module(
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> ModuleSpec | None:
spec = importlib.machinery.PathFinder.find_spec(modname, path=submodule_path)
Expand Down Expand Up @@ -373,7 +373,7 @@ def _find_spec_with_path(
search_path: Sequence[str],
modname: str,
module_parts: tuple[str],
processed: list[str],
processed: tuple[str],
submodule_path: Sequence[str] | None,
) -> tuple[Finder | _MetaPathFinder, ModuleSpec]:
for finder in _SPEC_FINDERS:
Expand Down Expand Up @@ -457,7 +457,7 @@ def _find_spec(module_path: tuple, path: tuple) -> ModuleSpec:
while modpath:
modname = modpath.pop(0)
finder, spec = _find_spec_with_path(
_path, modname, module_parts, processed, submodule_path or path
_path, modname, module_parts, tuple(processed), submodule_path or path
)
processed.append(modname)
if modpath:
Expand Down

0 comments on commit a389ef7

Please sign in to comment.