From d24915a92daaf4faa4caec23f0db3e6f087e6bd4 Mon Sep 17 00:00:00 2001 From: Divyansh Choudhary Date: Tue, 19 Nov 2024 13:06:46 +0530 Subject: [PATCH] Disable auto-import of lazy variables These variables come from the `pyflyby_autoimport_` namespace which exists in memory and shouldn't be added to a notebook. --- lib/python/pyflyby/_interactive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/python/pyflyby/_interactive.py b/lib/python/pyflyby/_interactive.py index d4ef152a..a6318120 100644 --- a/lib/python/pyflyby/_interactive.py +++ b/lib/python/pyflyby/_interactive.py @@ -36,6 +36,8 @@ indent) +PYFLYBY_LAZY_LOAD_PREFIX = "from pyflyby_autoimport_" + if False: __original__ = None # for pyflakes @@ -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,