Skip to content

Commit

Permalink
Address some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Divyansh Choudhary committed Nov 26, 2024
1 parent d24915a commit e263594
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/python/pyflyby/_dynimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

module_dict = {}

PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_"

def add_import(names: str, code: str, *, strict: bool = True):
"""
Expand Down Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions lib/python/pyflyby/_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,9 +36,6 @@
FunctionWithGlobals, NullCtx, advise,
indent)


PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_"

if False:
__original__ = None # for pyflakes

Expand Down

0 comments on commit e263594

Please sign in to comment.