Skip to content

Commit e29ba10

Browse files
committed
fixing ci mypy errors
1 parent 761e957 commit e29ba10

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

ninja_extra/controllers/model/schemas.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
from pydantic import BaseModel as PydanticModel
77
from pydantic import Field, field_validator
88

9+
if t.TYPE_CHECKING:
10+
from ninja_schema.errors import ConfigError
11+
from ninja_schema.orm.factory import SchemaFactory
12+
from ninja_schema.orm.model_schema import (
13+
ModelSchemaConfig as NinjaSchemaModelSchemaConfig,
14+
)
15+
from ninja_schema.orm.model_schema import (
16+
ModelSchemaConfigAdapter,
17+
)
18+
919
try:
1020
from ninja_schema import __version__ as ninja_schema_version
1121
from ninja_schema.errors import ConfigError
@@ -19,9 +29,10 @@
1929

2030
NINJA_SCHEMA_VERSION = tuple(map(int, ninja_schema_version.split(".")))
2131
except Exception: # pragma: no cover
22-
ConfigError = NinjaSchemaModelSchemaConfig = ModelSchemaConfigAdapter = (
23-
SchemaFactory
24-
) = None
32+
ConfigError = None
33+
NinjaSchemaModelSchemaConfig = None
34+
ModelSchemaConfigAdapter = None
35+
SchemaFactory = None
2536
NINJA_SCHEMA_VERSION = (0, 0, 0)
2637

2738

@@ -133,7 +144,7 @@ def generate_all_schema(self) -> None:
133144
# if all schemas have been provided, then we don't need to generate any schema
134145
return
135146

136-
if not NinjaSchemaModelSchemaConfig: # pragma: no cover
147+
if NinjaSchemaModelSchemaConfig is None: # pragma: no cover
137148
raise RuntimeError(
138149
"ninja-schema package is required for ModelControllerSchema generation.\n pip install ninja-schema"
139150
)

0 commit comments

Comments
 (0)