2121
2222from django .db .models import Model , QuerySet
2323from django .http import HttpResponse
24- from django .urls import URLPattern , path as django_path
24+ from django .urls import URLPattern
25+ from django .urls import path as django_path
2526from injector import inject , is_decorated_with_inject
2627from ninja import NinjaAPI , Router
2728from ninja .constants import NOT_SET
@@ -143,7 +144,7 @@ def permission_denied(cls, permission: BasePermission) -> None:
143144 def get_object_or_exception (
144145 self ,
145146 klass : Union [Type [Model ], QuerySet ],
146- error_message : str = None ,
147+ error_message : Optional [ str ] = None ,
147148 exception : Type [APIException ] = NotFound ,
148149 ** kwargs : Any ,
149150 ) -> Any :
@@ -267,7 +268,6 @@ def __init__(
267268 permissions : Optional ["PermissionType" ] = None ,
268269 auto_import : bool = True ,
269270 ) -> None :
270-
271271 self .prefix = prefix
272272 # `auth` primarily defines APIController route function global authentication method.
273273 self .auth : Optional [AuthBase ] = auth
@@ -278,8 +278,8 @@ def __init__(
278278 # `controller_class` target class that the APIController wraps
279279 self ._controller_class : Optional [Type ["ControllerBase" ]] = None
280280 # `_path_operations` a converted dict of APIController route function used by Django-Ninja library
281- self ._path_operations : Dict [str , ControllerPathView ] = dict ()
282- self ._controller_class_route_functions : Dict [str , RouteFunction ] = dict ()
281+ self ._path_operations : Dict [str , ControllerPathView ] = {}
282+ self ._controller_class_route_functions : Dict [str , RouteFunction ] = {}
283283 # `permission_classes` a collection of BasePermission Types
284284 # a fallback if route functions has no permissions definition
285285 self .permission_classes : PermissionType = permissions or [AllowAny ]
0 commit comments