Skip to content

Commit 00ab897

Browse files
committed
forced NOT_SET_TYPE to be compatible with older versions
1 parent 200431b commit 00ab897

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ninja_extra/compatible.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import sys
22

3+
from ninja.constants import NOT_SET
4+
5+
__all__ = ["asynccontextmanager", "NOT_SET_TYPE"]
6+
37
if sys.version_info >= (3, 7):
48
from contextlib import asynccontextmanager as asynccontextmanager # noqa
59
else:
610
from contextlib2 import asynccontextmanager as asynccontextmanager # noqa
11+
12+
try:
13+
from ninja.constants import NOT_SET_TYPE # noqa
14+
except Exception:
15+
NOT_SET_TYPE = type(NOT_SET) # noqa

ninja_extra/main.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
from ninja.renderers import BaseRenderer
1212

1313
from ninja_extra import exceptions, router
14+
from ninja_extra.compatible import NOT_SET_TYPE
1415
from ninja_extra.controllers.base import APIController, ControllerBase
1516
from ninja_extra.controllers.registry import ControllerRegistry
1617

17-
try:
18-
from ninja.constants import NOT_SET_TYPE # type:ignore
19-
except Exception:
20-
NOT_SET_TYPE = type(NOT_SET)
21-
2218
__all__ = [
2319
"NinjaExtraAPI",
2420
]

0 commit comments

Comments
 (0)