Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec51c50

Browse files
committed
Silence PickleShare warnings when completing root modules.
A better way woudl be to try to use the shelves module ?
1 parent 86d44b7 commit ec51c50

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

IPython/core/completerlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ def get_root_modules():
117117
# Don't try to scan for modules every time.
118118
return list(sys.builtin_module_names)
119119

120-
rootmodules_cache = ip.db.get('rootmodules_cache', {})
120+
if getattr(ip.db, "_mock", False):
121+
rootmodules_cache = {}
122+
else:
123+
rootmodules_cache = ip.db.get("rootmodules_cache", {})
121124
rootmodules = list(sys.builtin_module_names)
122125
start_time = time()
123126
store = False

IPython/core/interactiveshell.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
except ModuleNotFoundError:
4343

4444
class PickleShareDB: # type: ignore [no-redef]
45+
_mock = True
46+
4547
def __init__(self, path):
4648
pass
4749

0 commit comments

Comments
 (0)