Skip to content

Commit 16e44af

Browse files
committed
Remove all debugging junk
1 parent 19c49bb commit 16e44af

File tree

2 files changed

+0
-71
lines changed

2 files changed

+0
-71
lines changed

Lib/_pyrepl/_module_completer.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,12 @@ def _find_modules(self, path: str, prefix: str) -> list[str]:
130130
for segment in path.split('.'):
131131
modules = [mod_info for mod_info in modules
132132
if mod_info.ispkg and mod_info.name == segment]
133-
print(f"{segment=}, {modules=}") # TEMPORARY -- debugging tests on windows
134133
if is_stdlib_import is None:
135134
# Top-level import decide if we import from stdlib or not
136135
is_stdlib_import = all(
137136
self._is_stdlib_module(mod_info) for mod_info in modules
138137
)
139138
modules = self.iter_submodules(modules)
140-
modules = list(modules) # TEMPORARY -- debugging tests on windows
141-
print(f"segment=last, {modules=}") # TEMPORARY -- debugging tests on windows
142139

143140
module_names = [module.name for module in modules]
144141
if is_stdlib_import:
@@ -217,72 +214,7 @@ def global_cache(self) -> list[pkgutil.ModuleInfo]:
217214
"""Global module cache"""
218215
if not self._global_cache or self._curr_sys_path != sys.path:
219216
self._curr_sys_path = sys.path[:]
220-
print('getting packages/') # TEMPORARY -- debugging tests on windows
221217
self._global_cache = list(pkgutil.iter_modules())
222-
# === BEGIN TEMPORARY -- debugging tests on windows ===
223-
mymod = next((p for p in self._global_cache if p.name == "mymodule"), None)
224-
if mymod:
225-
print("0a", mymod)
226-
import glob
227-
print("files on finder path:", glob.glob("**", root_dir=mymod.module_finder.path, recursive=True))
228-
spec = mymod.module_finder.find_spec(mymod.name, None)
229-
print("found spec:", spec)
230-
mymod.module_finder.invalidate_caches()
231-
not_cached_spec = mymod.module_finder.find_spec(mymod.name, None)
232-
print("found spec after invalidate:", not_cached_spec)
233-
if spec:
234-
print("1")
235-
assert spec.submodule_search_locations and len(spec.submodule_search_locations) == 1
236-
print("2")
237-
importer = pkgutil.get_importer(spec.submodule_search_locations[0])
238-
print("3")
239-
assert importer and isinstance(importer, FileFinder)
240-
print("4")
241-
if importer.path is None or not os.path.isdir(importer.path):
242-
print("4a")
243-
return
244-
yielded = {}
245-
import inspect
246-
try:
247-
filenames = os.listdir(importer.path)
248-
except OSError:
249-
# ignore unreadable directories like import does
250-
print("4b")
251-
filenames = []
252-
print("4c", filenames)
253-
filenames.sort() # handle packages before same-named modules
254-
submods = []
255-
for fn in filenames:
256-
print("4d", fn)
257-
modname = inspect.getmodulename(fn)
258-
print("4e", modname)
259-
if modname=='__init__' or modname in yielded:
260-
print("4f", modname)
261-
continue
262-
path = os.path.join(importer.path, fn)
263-
ispkg = False
264-
if not modname and os.path.isdir(path) and '.' not in fn:
265-
print("4g")
266-
modname = fn
267-
try:
268-
dircontents = os.listdir(path)
269-
except OSError:
270-
# ignore unreadable directories like import does
271-
dircontents = []
272-
for fn in dircontents:
273-
subname = inspect.getmodulename(fn)
274-
if subname=='__init__':
275-
ispkg = True
276-
break
277-
else:
278-
continue # not a package
279-
if modname and '.' not in modname:
280-
print("4h")
281-
yielded[modname] = 1
282-
submods.append((importer, modname, ispkg))
283-
print("4i")
284-
print("module:", mymod, submods)
285-
# === END TEMPORARY ===
286218
return self._global_cache
287219

288220

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,9 +1142,6 @@ def test_already_imported_custom_module_no_other_suggestions(self):
11421142
self.assertEqual(output, "import mymodule.foo")
11431143

11441144
del sys.modules["mymodule"]
1145-
print(f"{dir1=}, {dir2=}") # TEMPORARY -- debugging tests on windows
1146-
print(f"{[p.relative_to(dir1) for p in dir1.glob("**")]=}") # TEMPORARY -- debugging tests on windows
1147-
print(f"{[p.relative_to(dir2) for p in dir2.glob("**")]=}") # TEMPORARY -- debugging tests on windows
11481145
# mymodule not imported anymore -> suggest dir2 submodules
11491146
events = code_to_events("import mymodule.\t\n")
11501147
reader = self.prepare_reader(events, namespace={})

0 commit comments

Comments
 (0)