mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-15 16:27:09 +08:00
sort out all test folders into passable and TODOs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, List, Optional, Union, Iterable, Sequence
|
||||
from typing import Dict, List, Optional, Union, Iterable, Sequence, Protocol, Any
|
||||
|
||||
from django.db.models.base import Model
|
||||
from django.db.models.query import QuerySet
|
||||
@@ -8,13 +8,23 @@ class InvalidPage(Exception): ...
|
||||
class PageNotAnInteger(InvalidPage): ...
|
||||
class EmptyPage(InvalidPage): ...
|
||||
|
||||
class SupportsLen(Protocol):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class SupportsCount(Protocol):
|
||||
def count(self) -> int: ...
|
||||
|
||||
class Paginator:
|
||||
object_list: QuerySet = ...
|
||||
per_page: int = ...
|
||||
orphans: int = ...
|
||||
allow_empty_first_page: bool = ...
|
||||
def __init__(
|
||||
self, object_list: Iterable, per_page: Union[int, str], orphans: int = ..., allow_empty_first_page: bool = ...
|
||||
self,
|
||||
object_list: Union[SupportsLen, SupportsCount],
|
||||
per_page: Union[int, str],
|
||||
orphans: int = ...,
|
||||
allow_empty_first_page: bool = ...,
|
||||
) -> None: ...
|
||||
def validate_number(self, number: Optional[Union[float, str]]) -> int: ...
|
||||
def get_page(self, number: Optional[int]) -> Page: ...
|
||||
|
||||
Reference in New Issue
Block a user