Skip to content

Commit

Permalink
chore: ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious committed Feb 29, 2024
1 parent f8b673d commit 5a87e7b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions invokeai/backend/model_manager/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ModelSearch(ModelSearchBase):
"""

models_found: Set[Path] = Field(default_factory=set)
config: InvokeAIAppConfig = InvokeAIAppConfig.get_config()
config: InvokeAIAppConfig = InvokeAIAppConfig.get_config()

def search_started(self) -> None:
self.models_found = set()
Expand Down Expand Up @@ -147,9 +147,11 @@ def search(self, directory: Union[Path, str]) -> Set[Path]:

def _walk_directory(self, path: Union[Path, str], max_depth: int = 20) -> None:
absolute_path = Path(path)
if len(absolute_path.parts) - len(self._directory.parts) > max_depth \
or not absolute_path.exists() \
or absolute_path.parent in self.models_found:
if (
len(absolute_path.parts) - len(self._directory.parts) > max_depth
or not absolute_path.exists()
or absolute_path.parent in self.models_found
):
return
entries = os.scandir(absolute_path.as_posix())
entries = [entry for entry in entries if not entry.name.startswith(".")]
Expand Down

0 comments on commit 5a87e7b

Please sign in to comment.