mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore: ruff
This commit is contained in:
parent
ae34bcfbc0
commit
0305e90287
@ -118,7 +118,7 @@ class ModelSearch(ModelSearchBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
models_found: Set[Path] = Field(default_factory=set)
|
models_found: Set[Path] = Field(default_factory=set)
|
||||||
config: InvokeAIAppConfig = InvokeAIAppConfig.get_config()
|
config: InvokeAIAppConfig = InvokeAIAppConfig.get_config()
|
||||||
|
|
||||||
def search_started(self) -> None:
|
def search_started(self) -> None:
|
||||||
self.models_found = set()
|
self.models_found = set()
|
||||||
@ -147,9 +147,11 @@ class ModelSearch(ModelSearchBase):
|
|||||||
|
|
||||||
def _walk_directory(self, path: Union[Path, str], max_depth: int = 20) -> None:
|
def _walk_directory(self, path: Union[Path, str], max_depth: int = 20) -> None:
|
||||||
absolute_path = Path(path)
|
absolute_path = Path(path)
|
||||||
if len(absolute_path.parts) - len(self._directory.parts) > max_depth \
|
if (
|
||||||
or not absolute_path.exists() \
|
len(absolute_path.parts) - len(self._directory.parts) > max_depth
|
||||||
or absolute_path.parent in self.models_found:
|
or not absolute_path.exists()
|
||||||
|
or absolute_path.parent in self.models_found
|
||||||
|
):
|
||||||
return
|
return
|
||||||
entries = os.scandir(absolute_path.as_posix())
|
entries = os.scandir(absolute_path.as_posix())
|
||||||
entries = [entry for entry in entries if not entry.name.startswith(".")]
|
entries = [entry for entry in entries if not entry.name.startswith(".")]
|
||||||
|
Loading…
Reference in New Issue
Block a user