Skip to content

Commit

Permalink
bug [finder]: ignore hidden folders
Browse files Browse the repository at this point in the history
When searching module subpaths to load files for parsing, skip hidden folders that start with the `.` character.

Issue mkdocstrings#185: mkdocstrings#185
  • Loading branch information
Robert Senseman committed Jul 26, 2023
1 parent 1e7b869 commit dee1522
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/griffe/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def _extend_from_pth_files(self) -> None:
def _filter_py_modules(self, path: Path) -> Iterator[Path]:
for root, dirs, files in os.walk(path, topdown=True):
# optimization: modify dirs in-place to exclude __pycache__ directories
dirs[:] = [dir for dir in dirs if dir != "__pycache__"]
# Also exclude hidden folders like .venv and .pycache
dirs[:] = [dir for dir in dirs if (dir != "__pycache__" and dir[0] != ".")]
for relfile in files:
if os.path.splitext(relfile)[1] in self.extensions_set:
yield Path(root, relfile)
Expand Down

0 comments on commit dee1522

Please sign in to comment.