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>
This commit is contained in:
claude[bot] 2026-03-17 08:13:04 +00:00
parent 8dc6d9eeda
commit 8f571ccd0f

View file

@ -48,15 +48,15 @@ def _ensure_languages_registered() -> None:
# Import support modules to trigger registration
# These imports are deferred to avoid circular imports
import contextlib
import importlib
with contextlib.suppress(ImportError):
from codeflash.languages.python import support as _
with contextlib.suppress(ImportError):
from codeflash.languages.javascript import support as _
with contextlib.suppress(ImportError):
from codeflash.languages.java import support as _ # noqa: F401
for _lang_module in (
"codeflash.languages.python.support",
"codeflash.languages.javascript.support",
"codeflash.languages.java.support",
):
with contextlib.suppress(ImportError):
importlib.import_module(_lang_module)
_languages_registered = True