Skip to content

Commit

Permalink
Merge pull request #383 from deshaw/fix/auto-imports
Browse files Browse the repository at this point in the history
Fix lazy loading of variables
  • Loading branch information
saharan-deshaw authored Dec 6, 2024
2 parents c73b22c + 84d40cb commit ace50d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/python/pyflyby/_dynimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ def _add_import(ip, names: str, code: str) -> None:
private version of add_import
"""
assert ip is not None
mang = PYFLYBY_LAZY_LOAD_PREFIX + names.replace(",", "_").replace(" ", "_")
a: FrozenSet[Import] = ImportSet(f"{mang} import {names}")._importset
module = PYFLYBY_LAZY_LOAD_PREFIX.split()[1]
mang = module + names.replace(",", "_").replace(" ", "_")
a: FrozenSet[Import] = ImportSet(f"from {mang} import {names}")._importset
b: FrozenSet[Import] = ip._auto_importer.db.known_imports._importset
s_import: FrozenSet[Import] = a | b

Expand Down

0 comments on commit ace50d6

Please sign in to comment.