diff --git a/litestar/_openapi/schema_generation/schema.py b/litestar/_openapi/schema_generation/schema.py index 2eb38e0433..743f30afcd 100644 --- a/litestar/_openapi/schema_generation/schema.py +++ b/litestar/_openapi/schema_generation/schema.py @@ -485,7 +485,7 @@ def for_object_type(self, field_definition: FieldDefinition) -> Schema: if field_definition.is_non_string_sequence or field_definition.is_non_string_iterable: # filters out ellipsis from tuple[int, ...] type annotations inner_types = (f for f in field_definition.inner_types if f.annotation is not Ellipsis) - items = list(map(self.for_field_definition, inner_types or ())) + items = list(map(self.for_field_definition, inner_types)) return Schema( type=OpenAPIType.ARRAY, diff --git a/litestar/_openapi/typescript_converter/converter.py b/litestar/_openapi/typescript_converter/converter.py index 4782dbe2e8..b2ec87c049 100644 --- a/litestar/_openapi/typescript_converter/converter.py +++ b/litestar/_openapi/typescript_converter/converter.py @@ -264,7 +264,7 @@ def convert_openapi_to_typescript(openapi_schema: OpenAPI, namespace: str = "API """ if not openapi_schema.paths: # pragma: no cover raise ValueError("OpenAPI schema has no paths") - if not openapi_schema.components: # pragma: no cover + if not openapi_schema.components: # type: ignore[truthy-bool] # pragma: no cover raise ValueError("OpenAPI schema has no components") operations: list[TypeScriptNamespace] = [] diff --git a/litestar/security/base.py b/litestar/security/base.py index fbe7913635..415e2dace7 100644 --- a/litestar/security/base.py +++ b/litestar/security/base.py @@ -89,10 +89,8 @@ def on_app_init(self, app_config: AppConfig) -> AppConfig: app_config.openapi_config = copy(app_config.openapi_config) if isinstance(app_config.openapi_config.components, list): app_config.openapi_config.components.append(self.openapi_components) - elif app_config.openapi_config.components: - app_config.openapi_config.components = [self.openapi_components, app_config.openapi_config.components] else: - app_config.openapi_config.components = [self.openapi_components] + app_config.openapi_config.components = [self.openapi_components, app_config.openapi_config.components] if isinstance(app_config.openapi_config.security, list): app_config.openapi_config.security.append(self.security_requirement) diff --git a/pyproject.toml b/pyproject.toml index e0cc63efa2..aa4e9948ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -247,6 +247,7 @@ xfail_strict = true packages = ["litestar", "tests"] plugins = ["pydantic.mypy"] enable_error_code = [ + "truthy-bool", "truthy-iterable", "unused-awaitable", "ignore-without-code", @@ -256,21 +257,19 @@ enable_error_code = [ python_version = "3.8" disallow_any_generics = false -disallow_untyped_decorators = true -implicit_reexport = false show_error_codes = true strict = true -warn_redundant_casts = true -warn_return_any = true warn_unreachable = true -warn_unused_configs = true -warn_unused_ignores = true local_partial_types = true [[tool.mypy.overrides]] ignore_errors = true module = ["tests.examples.*", "tests.docker_service_fixtures"] +[[tool.mypy.overrides]] +module = ["tests.*"] +disable_error_code = ["truthy-bool"] + [[tool.mypy.overrides]] disallow_untyped_decorators = false module = ["tests.unit.test_kwargs.test_reserved_kwargs_injection"]