Skip to content

Commit 8f571cc

Browse files
fix: resolve mypy "Name _ already defined" error in registry.py
Replace three `from X import support as _` patterns with a loop using `importlib.import_module()`, eliminating the duplicate name binding. Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
1 parent 8dc6d9e commit 8f571cc

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

codeflash/languages/registry.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ def _ensure_languages_registered() -> None:
4848
# Import support modules to trigger registration
4949
# These imports are deferred to avoid circular imports
5050
import contextlib
51-
52-
with contextlib.suppress(ImportError):
53-
from codeflash.languages.python import support as _
54-
55-
with contextlib.suppress(ImportError):
56-
from codeflash.languages.javascript import support as _
57-
58-
with contextlib.suppress(ImportError):
59-
from codeflash.languages.java import support as _ # noqa: F401
51+
import importlib
52+
53+
for _lang_module in (
54+
"codeflash.languages.python.support",
55+
"codeflash.languages.javascript.support",
56+
"codeflash.languages.java.support",
57+
):
58+
with contextlib.suppress(ImportError):
59+
importlib.import_module(_lang_module)
6060

6161
_languages_registered = True
6262

0 commit comments

Comments
 (0)