@@ -202,7 +202,7 @@ class CursorPagination(AsyncPaginationBase):
202202 def __init__ (
203203 self ,
204204 * ,
205- ordering : tuple [str , ...] = settings .PAGINATION_DEFAULT_ORDERING ,
205+ ordering : Tuple [str , ...] = settings .PAGINATION_DEFAULT_ORDERING ,
206206 page_size : int = settings .PAGINATION_PER_PAGE ,
207207 max_page_size : int = settings .PAGINATION_MAX_PER_PAGE_SIZE ,
208208 ** kwargs : Any ,
@@ -221,13 +221,13 @@ def __init__(
221221 super ().__init__ (** kwargs )
222222
223223 class Input (Schema ):
224- page_size : int | None = None
225- cursor : str | None = None
224+ page_size : Optional [ int ] = None
225+ cursor : Optional [ str ] = None
226226
227227 class Output (Schema ):
228- previous : str | None
229- next : str | None
230- results : list [Any ]
228+ previous : Optional [ str ]
229+ next : Optional [ str ]
230+ results : List [Any ]
231231
232232 class Cursor (BaseModel ):
233233 """
@@ -238,7 +238,7 @@ class Cursor(BaseModel):
238238 """
239239
240240 p : Annotated [
241- str | None ,
241+ Optional [ str ] ,
242242 Field (
243243 title = "position" ,
244244 description = "String identifier for the current position in the dataset" ,
@@ -278,7 +278,7 @@ def validate_individual_queryparam(cls, value: Any) -> Any:
278278
279279 @classmethod
280280 def from_encoded_param (
281- cls , encoded_param : str | None , context : Any = None
281+ cls , encoded_param : Optional [ str ] , context : Any = None
282282 ) -> "CursorPagination.Cursor" :
283283 """
284284 Deserialize cursor from URL-safe base64 token.
@@ -306,7 +306,7 @@ def encode_as_param(self) -> str:
306306 return b64encode (query_string .encode ("ascii" )).decode ("ascii" )
307307
308308 @staticmethod
309- def _reverse_order (order : tuple [str , ...]) -> tuple [str , ...]:
309+ def _reverse_order (order : Tuple [str , ...]) -> Tuple [str , ...]:
310310 """
311311 Flip ordering direction for backward pagination.
312312
@@ -326,7 +326,7 @@ def _get_position(self, item: Any) -> str:
326326 """
327327 return str (getattr (item , self ._order_attribute ))
328328
329- def _get_page_size (self , requested_page_size : int | None ) -> int :
329+ def _get_page_size (self , requested_page_size : Optional [ int ] ) -> int :
330330 """
331331 Determine the actual page size to use, respecting configured limits.
332332
@@ -341,9 +341,9 @@ def _get_page_size(self, requested_page_size: int | None) -> int:
341341 def _build_next_cursor (
342342 self ,
343343 current_cursor : Cursor ,
344- results : list [Any ],
345- additional_position : str | None = None ,
346- ) -> Cursor | None :
344+ results : List [Any ],
345+ additional_position : Optional [ str ] = None ,
346+ ) -> Optional [ Cursor ] :
347347 """
348348 Build cursor for next page
349349 """
@@ -376,9 +376,9 @@ def _build_next_cursor(
376376 def _build_previous_cursor (
377377 self ,
378378 current_cursor : Cursor ,
379- results : list [Any ],
380- additional_position : str | None = None ,
381- ) -> Cursor | None :
379+ results : List [Any ],
380+ additional_position : Optional [ str ] = None ,
381+ ) -> Optional [ Cursor ] :
382382 """
383383 Build cursor for previous page
384384 """
@@ -418,7 +418,7 @@ def _build_previous_cursor(
418418 return self .Cursor (o = offset , r = True , p = previous_position )
419419
420420 @staticmethod
421- def _add_cursor_to_URL (url : str , cursor : Cursor | None ) -> str | None :
421+ def _add_cursor_to_URL (url : str , cursor : Optional [ Cursor ] ) -> Optional [ str ] :
422422 """
423423 Build pagination URLs with an encoded cursor.
424424
0 commit comments