Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove import search within current directory #611

Closed
wants to merge 4 commits into from
Closed
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
25 changes: 0 additions & 25 deletions tango/common/registrable.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,31 +213,6 @@ def try_import(module, recursive: bool = True):
if name in Registrable._registry[cls]:
return None

# Check Python files and modules in the current directory.
from glob import glob
from pathlib import Path

for pyfile in glob("*.py"):
module = str(Path(pyfile).with_suffix(""))
if module == "setup":
continue
try:
try_import(module)
if name in Registrable._registry[cls]:
return None
except: # noqa: E722
continue
for pyinit in glob("**/__init__.py"):
module = str(Path(pyinit).parent)
if module == "tango" or module.startswith("test"):
continue
try:
try_import(module)
if name in Registrable._registry[cls]:
return None
except: # noqa: E722
continue

# Search all other modules in Tango.
for module in find_submodules(exclude={"tango.integrations*"}, recursive=False):
try_import(module)
Expand Down
Loading