Skip to content

Commit 0a82cf5

Browse files
committed
refactor: Reuse private method to append search path to reduce code duplication
1 parent 708fd84 commit 0a82cf5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/griffe/_internal/finder.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def append_search_path(self, path: Path) -> None:
125125
Parameters:
126126
path: The path to append.
127127
"""
128-
path = path.resolve()
128+
self._append_search_path(path.resolve())
129+
130+
def _append_search_path(self, path: Path) -> None:
129131
if path not in self.search_paths:
130132
self.search_paths.append(path)
131133

@@ -379,10 +381,6 @@ def _contents(self, path: Path) -> list[Path]:
379381
self._paths_contents[path] = []
380382
return self._paths_contents[path]
381383

382-
def _append_search_path(self, path: Path) -> None:
383-
if path not in self.search_paths:
384-
self.search_paths.append(path)
385-
386384
def _extend_from_pth_files(self) -> None:
387385
for path in self.search_paths:
388386
for item in self._contents(path):

0 commit comments

Comments
 (0)