Skip to content

Commit 362e821

Browse files
committed
Review feedback
1 parent 6f38649 commit 362e821

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Lib/_pyrepl/_module_completer.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
HARDCODED_SUBMODULES = {
2020
# Standard library submodules that are not detected by pkgutil.iter_modules
2121
# but can be imported, so should be proposed in completion
22-
"collections": ["abc"],
23-
"os": ["path"],
24-
"xml.parsers.expat": ["errors", "model"],
22+
"collections": ("abc",),
23+
"os": ("path",),
24+
"xml.parsers.expat": ("errors", "model"),
2525
}
2626

2727

@@ -109,11 +109,8 @@ def _find_modules(self, path: str, prefix: str) -> list[str]:
109109
if mod_info.ispkg and mod_info.name == segment]
110110
modules = self.iter_submodules(modules)
111111

112-
module_names = [module.name for module in modules]
113-
try:
114-
module_names += HARDCODED_SUBMODULES[path]
115-
except KeyError:
116-
pass
112+
module_names = ([module.name for module in modules]
113+
+ HARDCODED_SUBMODULES.get(path, []))
117114
return [module_name for module_name in module_names
118115
if self.is_suggestion_match(module_name, prefix)]
119116

0 commit comments

Comments
 (0)