mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
RUF013 update
This commit is contained in:
+4
-4
@@ -10,11 +10,11 @@ def get_swagger_ui_html(*,
|
||||
title: str,
|
||||
swagger_js_url: str = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js",
|
||||
swagger_css_url: str = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css",
|
||||
swagger_extra_css_url: str = None,
|
||||
swagger_extra_css_url: str | None = None,
|
||||
swagger_favicon_url: str = "https://fastapi.tiangolo.com/img/favicon.png",
|
||||
oauth2_redirect_url: str = None,
|
||||
init_oauth: dict = None,
|
||||
swagger_ui_parameters: dict = None,
|
||||
oauth2_redirect_url: str | None = None,
|
||||
init_oauth: dict | None = None,
|
||||
swagger_ui_parameters: dict | None = None,
|
||||
) -> HTMLResponse:
|
||||
current_swagger_ui_parameters = swagger_ui_default_parameters.copy()
|
||||
if swagger_ui_parameters:
|
||||
|
||||
@@ -242,7 +242,7 @@ def get_checkpoint():
|
||||
checkpoint['hash'] = shared.sd_model.sd_checkpoint_info.shorthash
|
||||
return checkpoint
|
||||
|
||||
def set_checkpoint(sd_model_checkpoint: str, dtype:str=None, force:bool=False):
|
||||
def set_checkpoint(sd_model_checkpoint: str, dtype: str | None = None, force: bool = False):
|
||||
"""Load a checkpoint by name. Optionally set dtype and force a clean reload."""
|
||||
from modules import sd_models, devices
|
||||
if force:
|
||||
|
||||
@@ -57,10 +57,10 @@ def underscore(name: str) -> str: # Convert CamelCase or PascalCase string to un
|
||||
class PydanticModelGenerator:
|
||||
def __init__(
|
||||
self,
|
||||
model_name: str = None,
|
||||
class_instance = None,
|
||||
additional_fields = None,
|
||||
exclude_fields: list = None,
|
||||
model_name: str,
|
||||
class_instance,
|
||||
additional_fields: list,
|
||||
exclude_fields: list | None = None,
|
||||
):
|
||||
if exclude_fields is None:
|
||||
exclude_fields = []
|
||||
@@ -100,7 +100,7 @@ class PydanticModelGenerator:
|
||||
self._model_def = [x for x in self._model_def if x.field != fld]
|
||||
|
||||
def generate_model(self):
|
||||
model_fields = { d.field: (d.field_type, Field(default=d.field_value, alias=d.field_alias, exclude=d.field_exclude)) for d in self._model_def }
|
||||
model_fields: dict[str, Any] = { d.field: (d.field_type, Field(default=d.field_value, alias=d.field_alias, exclude=d.field_exclude)) for d in self._model_def }
|
||||
if PYDANTIC_V2:
|
||||
config = ConfigDict(arbitrary_types_allowed=True, from_attributes=True, populate_by_name=True)
|
||||
else:
|
||||
@@ -507,7 +507,7 @@ class ItemLoadedModel(BaseModel):
|
||||
|
||||
# helper function
|
||||
|
||||
def create_model_from_signature(func: Callable, model_name: str, base_model: type[BaseModel] = BaseModel, additional_fields: list = None, exclude_fields: list[str] = None) -> type[BaseModel]:
|
||||
def create_model_from_signature(func: Callable, model_name: str, base_model: type[BaseModel] = BaseModel, additional_fields: list | None = None, exclude_fields: list[str] | None = None) -> type[BaseModel]:
|
||||
from PIL import Image
|
||||
|
||||
if exclude_fields is None:
|
||||
|
||||
Reference in New Issue
Block a user