mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Ruff checks
This commit is contained in:
parent
8992d89817
commit
f16e64084b
@ -273,7 +273,7 @@ async def scan_for_models(
|
|||||||
scan_path: str = Query(description="Directory path to search for models", default=None),
|
scan_path: str = Query(description="Directory path to search for models", default=None),
|
||||||
) -> List[FoundModel]:
|
) -> List[FoundModel]:
|
||||||
path = pathlib.Path(scan_path)
|
path = pathlib.Path(scan_path)
|
||||||
if not scan_path or not path.is_dir():
|
if not path.is_dir():
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
detail=f"The search path '{scan_path}' does not exist or is not directory",
|
detail=f"The search path '{scan_path}' does not exist or is not directory",
|
||||||
|
@ -25,10 +25,10 @@ from abc import ABC, abstractmethod
|
|||||||
from logging import Logger
|
from logging import Logger
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Callable, Optional, Set, Union
|
from typing import Callable, Optional, Set, Union
|
||||||
from invokeai.app.services.config import InvokeAIAppConfig
|
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from invokeai.app.services.config import InvokeAIAppConfig
|
||||||
from invokeai.backend.util.logging import InvokeAILogger
|
from invokeai.backend.util.logging import InvokeAILogger
|
||||||
|
|
||||||
default_logger: Logger = InvokeAILogger.get_logger()
|
default_logger: Logger = InvokeAILogger.get_logger()
|
||||||
@ -167,15 +167,15 @@ class ModelSearch(ModelSearchBase):
|
|||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
self.model_found(absolute_path)
|
self.model_found(absolute_path)
|
||||||
|
return
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.warning(str(e))
|
self.logger.warning(str(e))
|
||||||
finally:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for n in file_names:
|
for n in file_names:
|
||||||
if any([n.endswith(suffix) for suffix in {".ckpt", ".bin", ".pth", ".safetensors", ".pt"}]):
|
if n.endswith((".ckpt", ".bin", ".pth", ".safetensors", ".pt")):
|
||||||
try:
|
try:
|
||||||
self.model_found(absolute_path / n)
|
self.model_found(absolute_path / n)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
Loading…
Reference in New Issue
Block a user