Skip to content

Commit 3944fa7

Browse files
committed
Shortcircuit some paths
1 parent 900a273 commit 3944fa7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bpython/importcompletion.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ def find_modules(self, path: Path) -> Generator[Optional[str], None, None]:
186186

187187
finder = importlib.machinery.FileFinder(str(path), *LOADERS) # type: ignore
188188
for p in children:
189-
if any(fnmatch.fnmatch(p.name, entry) for entry in self.skiplist):
189+
if p.name.startswith(".") or p.name == "__pycache__":
190+
# Impossible to import from names starting with . and we can skip __pycache__
191+
continue
192+
elif any(fnmatch.fnmatch(p.name, entry) for entry in self.skiplist):
190193
# Path is on skiplist
191194
continue
192195
elif not any(p.name.endswith(suffix) for suffix in SUFFIXES):

0 commit comments

Comments
 (0)