mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-08 04:54:48 +08:00
Issue 382 (#384)
* WIP fix, pushed for testing * added _ prefix for internal types Co-authored-by: Kacper Szmigiel <szmigielkacper@gmai.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union, Protocol
|
||||||
|
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.contrib.sites.requests import RequestSite
|
from django.contrib.sites.requests import RequestSite
|
||||||
@@ -13,10 +13,19 @@ class SitemapNotFound(Exception): ...
|
|||||||
|
|
||||||
def ping_google(sitemap_url: Optional[str] = ..., ping_url: str = ...) -> None: ...
|
def ping_google(sitemap_url: Optional[str] = ..., ping_url: str = ...) -> None: ...
|
||||||
|
|
||||||
|
class _SupportsLen(Protocol):
|
||||||
|
def __len__(self) -> int: ...
|
||||||
|
|
||||||
|
class _SupportsCount(Protocol):
|
||||||
|
def count(self) -> int: ...
|
||||||
|
|
||||||
|
class _SupportsOrdered(Protocol):
|
||||||
|
ordered: bool = ...
|
||||||
|
|
||||||
class Sitemap:
|
class Sitemap:
|
||||||
limit: int = ...
|
limit: int = ...
|
||||||
protocol: Optional[str] = ...
|
protocol: Optional[str] = ...
|
||||||
def items(self) -> List[Any]: ...
|
def items(self) -> Union[_SupportsLen, _SupportsCount, _SupportsOrdered]: ...
|
||||||
def location(self, obj: Model) -> str: ...
|
def location(self, obj: Model) -> str: ...
|
||||||
@property
|
@property
|
||||||
def paginator(self) -> Paginator: ...
|
def paginator(self) -> Paginator: ...
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ class InvalidPage(Exception): ...
|
|||||||
class PageNotAnInteger(InvalidPage): ...
|
class PageNotAnInteger(InvalidPage): ...
|
||||||
class EmptyPage(InvalidPage): ...
|
class EmptyPage(InvalidPage): ...
|
||||||
|
|
||||||
class SupportsLen(Protocol):
|
class _SupportsLen(Protocol):
|
||||||
def __len__(self) -> int: ...
|
def __len__(self) -> int: ...
|
||||||
|
|
||||||
class SupportsCount(Protocol):
|
class _SupportsCount(Protocol):
|
||||||
def count(self) -> int: ...
|
def count(self) -> int: ...
|
||||||
|
|
||||||
class SupportsOrdered(Protocol):
|
class _SupportsOrdered(Protocol):
|
||||||
ordered: bool = ...
|
ordered: bool = ...
|
||||||
|
|
||||||
class Paginator:
|
class Paginator:
|
||||||
@@ -24,7 +24,7 @@ class Paginator:
|
|||||||
allow_empty_first_page: bool = ...
|
allow_empty_first_page: bool = ...
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
object_list: Union[SupportsLen, SupportsCount, SupportsOrdered],
|
object_list: Union[_SupportsLen, _SupportsCount, _SupportsOrdered],
|
||||||
per_page: Union[int, str],
|
per_page: Union[int, str],
|
||||||
orphans: int = ...,
|
orphans: int = ...,
|
||||||
allow_empty_first_page: bool = ...,
|
allow_empty_first_page: bool = ...,
|
||||||
|
|||||||
Reference in New Issue
Block a user