diff --git a/lib/python/pyflyby/_dynimp.py b/lib/python/pyflyby/_dynimp.py index 69282a9c..1289358a 100644 --- a/lib/python/pyflyby/_dynimp.py +++ b/lib/python/pyflyby/_dynimp.py @@ -49,6 +49,7 @@ module_dict = {} +PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_" def add_import(names: str, code: str, *, strict: bool = True): """ @@ -110,8 +111,8 @@ def _add_import(ip, names: str, code: str) -> None: private version of add_import """ assert ip is not None - mang = "pyflyby_autoimport_" + names.replace(",", "_").replace(" ", "_") - a: FrozenSet[Import] = ImportSet(f"from {mang} import {names}")._importset + mang = PYFLYBY_LAZY_LOAD_PREFIX + names.replace(",", "_").replace(" ", "_") + a: FrozenSet[Import] = ImportSet(f"{mang} import {names}")._importset b: FrozenSet[Import] = ip._auto_importer.db.known_imports._importset s_import: FrozenSet[Import] = a | b diff --git a/lib/python/pyflyby/_interactive.py b/lib/python/pyflyby/_interactive.py index a6318120..ea11ecdc 100644 --- a/lib/python/pyflyby/_interactive.py +++ b/lib/python/pyflyby/_interactive.py @@ -22,7 +22,8 @@ auto_import, clear_failed_imports_cache, load_symbol) -from pyflyby._dynimp import inject as inject_dynamic_import +from pyflyby._dynimp import (inject as inject_dynamic_import, + PYFLYBY_LAZY_LOAD_PREFIX) from pyflyby._comms import (initialize_comms, remove_comms, send_comm_message, MISSING_IMPORTS) from pyflyby._file import Filename, atomic_write_file, read_file @@ -35,9 +36,6 @@ FunctionWithGlobals, NullCtx, advise, indent) - -PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_" - if False: __original__ = None # for pyflakes