chore: add ast-grep rule to convert Optional[T] to T | None (#25560)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
2e44ebe98d
commit
bab4975809
394 changed files with 2555 additions and 2792 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from core.entities.model_entities import ModelWithProviderEntity, ProviderModelWithStatusEntity
|
||||
from core.model_runtime.entities.model_entities import ModelType, ParameterRule
|
||||
|
|
@ -52,7 +51,7 @@ class ModelProviderService:
|
|||
|
||||
return provider_configuration
|
||||
|
||||
def get_provider_list(self, tenant_id: str, model_type: Optional[str] = None) -> list[ProviderResponse]:
|
||||
def get_provider_list(self, tenant_id: str, model_type: str | None = None) -> list[ProviderResponse]:
|
||||
"""
|
||||
get provider list.
|
||||
|
||||
|
|
@ -128,9 +127,7 @@ class ModelProviderService:
|
|||
for model in provider_configurations.get_models(provider=provider)
|
||||
]
|
||||
|
||||
def get_provider_credential(
|
||||
self, tenant_id: str, provider: str, credential_id: Optional[str] = None
|
||||
) -> Optional[dict]:
|
||||
def get_provider_credential(self, tenant_id: str, provider: str, credential_id: str | None = None) -> dict | None:
|
||||
"""
|
||||
get provider credentials.
|
||||
|
||||
|
|
@ -216,7 +213,7 @@ class ModelProviderService:
|
|||
|
||||
def get_model_credential(
|
||||
self, tenant_id: str, provider: str, model_type: str, model: str, credential_id: str | None
|
||||
) -> Optional[dict]:
|
||||
) -> dict | None:
|
||||
"""
|
||||
Retrieve model-specific credentials.
|
||||
|
||||
|
|
@ -449,7 +446,7 @@ class ModelProviderService:
|
|||
|
||||
return model_schema.parameter_rules if model_schema else []
|
||||
|
||||
def get_default_model_of_model_type(self, tenant_id: str, model_type: str) -> Optional[DefaultModelResponse]:
|
||||
def get_default_model_of_model_type(self, tenant_id: str, model_type: str) -> DefaultModelResponse | None:
|
||||
"""
|
||||
get default model of model type.
|
||||
|
||||
|
|
@ -498,7 +495,7 @@ class ModelProviderService:
|
|||
|
||||
def get_model_provider_icon(
|
||||
self, tenant_id: str, provider: str, icon_type: str, lang: str
|
||||
) -> tuple[Optional[bytes], Optional[str]]:
|
||||
) -> tuple[bytes | None, str | None]:
|
||||
"""
|
||||
get model provider icon.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue