Skip to content

Commit

Permalink
Disable auto-import of lazy variables
Browse files Browse the repository at this point in the history
These variables come from the `pyflyby_autoimport_` namespace which
exists in memory and shouldn't be added to a notebook.
  • Loading branch information
Divyansh Choudhary committed Nov 19, 2024
1 parent 1fff0de commit d24915a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/python/pyflyby/_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
indent)


PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_"

if False:
__original__ = None # for pyflakes

Expand Down Expand Up @@ -2151,7 +2153,8 @@ def auto_import(
namespaces = get_global_namespaces(self._ip)

def post_import_hook(imp):
send_comm_message(MISSING_IMPORTS, {"missing_imports": str(imp)})
if not str(imp).startswith(PYFLYBY_LAZY_LOAD_PREFIX):
send_comm_message(MISSING_IMPORTS, {"missing_imports": str(imp)})

return self._safe_call(
auto_import, arg=arg, namespaces=namespaces,
Expand Down

0 comments on commit d24915a

Please sign in to comment.