Skip to content

Commit b981cdf

Browse files
committed
Python <= 3.7 compatibility
1 parent d1a4a36 commit b981cdf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ninja/pagination.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def _find_collection_response(op: Operation) -> Tuple[int, Any]:
241241
class Cursor:
242242
offset: int = 0
243243
reverse: bool = False
244-
position: str | None = None
244+
position: Optional[str] = None
245245

246246

247247
def _clamp(val: int, min_: int, max_: int) -> int:
@@ -272,14 +272,14 @@ def _replace_query_param(url: str, key: str, val: str):
272272

273273
class CursorPagination(PaginationBase):
274274
class Input(Schema):
275-
limit: int | None = Field(None, description=_("Number of results to return per page."))
276-
cursor: str | None = Field(
275+
limit: Optional[int] = Field(None, description=_("Number of results to return per page."))
276+
cursor: Optional[str] = Field(
277277
None, description=_("The pagination cursor value."), validate_default=True
278278
)
279279

280280
@field_validator("cursor")
281281
@classmethod
282-
def decode_cursor(cls, encoded_cursor: str | None) -> Cursor:
282+
def decode_cursor(cls, encoded_cursor: Optional[str]) -> Cursor:
283283
if encoded_cursor is None:
284284
return Cursor()
285285

@@ -300,10 +300,10 @@ def decode_cursor(cls, encoded_cursor: str | None) -> Cursor:
300300
return Cursor(offset=offset, reverse=reverse, position=position)
301301

302302
class Output(Schema):
303-
results: list[Any] = Field(description=_("The page of objects."))
303+
results: List[Any] = Field(description=_("The page of objects."))
304304
count: int = Field(description=_("The total number of results across all pages."))
305-
next: str | None = Field(description=_("URL of next page of results if there is one."))
306-
previous: str | None = Field(
305+
next: Optional[str] = Field(description=_("URL of next page of results if there is one."))
306+
previous: Optional[str] = Field(
307307
description=_("URL of previous page of results if there is one.")
308308
)
309309

0 commit comments

Comments
 (0)