mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-10 05:51:53 +08:00
run black over stubs, add checking to travis
This commit is contained in:
@@ -10,23 +10,18 @@ from .base import (
|
||||
reverse_lazy as reverse_lazy,
|
||||
set_script_prefix as set_script_prefix,
|
||||
set_urlconf as set_urlconf,
|
||||
translate_url as translate_url
|
||||
translate_url as translate_url,
|
||||
)
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .conf import (
|
||||
include as include,
|
||||
path as path,
|
||||
re_path as re_path
|
||||
)
|
||||
from .conf import include as include, path as path, re_path as re_path
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .converters import (
|
||||
register_converter as register_converter
|
||||
)
|
||||
from .converters import register_converter as register_converter
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .exceptions import (
|
||||
NoReverseMatch as NoReverseMatch,
|
||||
Resolver404 as Resolver404
|
||||
)
|
||||
from .exceptions import NoReverseMatch as NoReverseMatch, Resolver404 as Resolver404
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .resolvers import (
|
||||
LocalePrefixPattern as LocalePrefixPattern,
|
||||
@@ -34,10 +29,8 @@ from .resolvers import (
|
||||
URLPattern as URLPattern,
|
||||
URLResolver as URLResolver,
|
||||
get_ns_resolver as get_ns_resolver,
|
||||
get_resolver as get_resolver
|
||||
get_resolver as get_resolver,
|
||||
)
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from .utils import (
|
||||
get_callable as get_callable,
|
||||
get_mod_func as get_mod_func
|
||||
)
|
||||
from .utils import get_callable as get_callable, get_mod_func as get_mod_func
|
||||
|
||||
@@ -7,17 +7,12 @@ from .exceptions import NoReverseMatch, Resolver404
|
||||
from .resolvers import get_ns_resolver, get_resolver
|
||||
from .utils import get_callable
|
||||
|
||||
|
||||
def resolve(path: str, urlconf: Optional[str] = ...) -> ResolverMatch: ...
|
||||
def reverse(
|
||||
viewname: Optional[Union[Callable, str]],
|
||||
urlconf: Optional[str] = ...,
|
||||
args: Optional[Union[List[UUID], Tuple]] = ...,
|
||||
kwargs: Optional[
|
||||
Union[
|
||||
Dict[str, None], Dict[str, bytes], Dict[str, str], Dict[str, UUID]
|
||||
]
|
||||
] = ...,
|
||||
kwargs: Optional[Union[Dict[str, None], Dict[str, bytes], Dict[str, str], Dict[str, UUID]]] = ...,
|
||||
current_app: Optional[str] = ...,
|
||||
) -> str: ...
|
||||
|
||||
|
||||
@@ -2,22 +2,12 @@ from typing import Any, Callable, List, Optional, Tuple, Union
|
||||
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
from .resolvers import (LocalePrefixPattern, RegexPattern, RoutePattern,
|
||||
URLPattern, URLResolver)
|
||||
|
||||
from .resolvers import LocalePrefixPattern, RegexPattern, RoutePattern, URLPattern, URLResolver
|
||||
|
||||
def include(
|
||||
arg: Union[
|
||||
List[Tuple[str, Callable]],
|
||||
List[URLPattern],
|
||||
List[URLResolver],
|
||||
Tuple[List[URLResolver], str],
|
||||
str,
|
||||
],
|
||||
arg: Union[List[Tuple[str, Callable]], List[URLPattern], List[URLResolver], Tuple[List[URLResolver], str], str],
|
||||
namespace: Optional[str] = ...,
|
||||
) -> Union[
|
||||
Tuple[List[Any], str, str], Tuple[List[URLResolver], None, None]
|
||||
]: ...
|
||||
) -> Union[Tuple[List[Any], str, str], Tuple[List[URLResolver], None, None]]: ...
|
||||
|
||||
path: Any
|
||||
re_path: Any
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import Any, Dict, Optional, Type, Union
|
||||
from uuid import UUID
|
||||
|
||||
|
||||
class IntConverter:
|
||||
regex: str = ...
|
||||
def to_python(self, value: str) -> int: ...
|
||||
@@ -27,9 +26,5 @@ DEFAULT_CONVERTERS: Any
|
||||
REGISTERED_CONVERTERS: Any
|
||||
|
||||
def register_converter(converter: Type[Any], type_name: str) -> None: ...
|
||||
def get_converters() -> Dict[
|
||||
str, Union[IntConverter, StringConverter, UUIDConverter]
|
||||
]: ...
|
||||
def get_converter(
|
||||
raw_converter: str
|
||||
) -> Union[IntConverter, StringConverter, UUIDConverter]: ...
|
||||
def get_converters() -> Dict[str, Union[IntConverter, StringConverter, UUIDConverter]]: ...
|
||||
def get_converter(raw_converter: str) -> Union[IntConverter, StringConverter, UUIDConverter]: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from django.http import Http404
|
||||
|
||||
|
||||
class Resolver404(Http404):
|
||||
pass
|
||||
|
||||
|
||||
class NoReverseMatch(Exception):
|
||||
pass
|
||||
|
||||
@@ -7,7 +7,6 @@ from django.core.checks.messages import CheckMessage, Warning
|
||||
from django.urls.converters import UUIDConverter
|
||||
from django.utils.datastructures import MultiValueDict
|
||||
|
||||
|
||||
class ResolverMatch:
|
||||
func: Callable = ...
|
||||
args: Tuple = ...
|
||||
@@ -29,19 +28,13 @@ class ResolverMatch:
|
||||
) -> None: ...
|
||||
def __getitem__(self, index: int) -> Any: ...
|
||||
|
||||
def get_resolver(
|
||||
urlconf: Optional[Union[Type[Any], str]] = ...
|
||||
) -> URLResolver: ...
|
||||
def get_ns_resolver(
|
||||
ns_pattern: str, resolver: URLResolver, converters: Tuple
|
||||
) -> URLResolver: ...
|
||||
def get_resolver(urlconf: Optional[Union[Type[Any], str]] = ...) -> URLResolver: ...
|
||||
def get_ns_resolver(ns_pattern: str, resolver: URLResolver, converters: Tuple) -> URLResolver: ...
|
||||
|
||||
class LocaleRegexDescriptor:
|
||||
attr: str = ...
|
||||
def __init__(self, attr: Any) -> None: ...
|
||||
def __get__(
|
||||
self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...
|
||||
) -> LocaleRegexDescriptor: ...
|
||||
def __get__(self, instance: Optional[RegexPattern], cls: Type[RegexPattern] = ...) -> LocaleRegexDescriptor: ...
|
||||
|
||||
class CheckURLMixin:
|
||||
def describe(self) -> str: ...
|
||||
@@ -50,24 +43,16 @@ class RegexPattern(CheckURLMixin):
|
||||
regex: Any = ...
|
||||
name: Optional[str] = ...
|
||||
converters: Dict[Any, Any] = ...
|
||||
def __init__(
|
||||
self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
||||
) -> None: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ...
|
||||
def __init__(self, regex: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, str]]]: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
|
||||
class RoutePattern(CheckURLMixin):
|
||||
regex: Any = ...
|
||||
name: Optional[str] = ...
|
||||
converters: Dict[str, UUIDConverter] = ...
|
||||
def __init__(
|
||||
self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...
|
||||
) -> None: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ...
|
||||
def __init__(self, route: str, name: Optional[str] = ..., is_endpoint: bool = ...) -> None: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[str, Union[int, str]]]]: ...
|
||||
def check(self) -> List[Warning]: ...
|
||||
|
||||
class LocalePrefixPattern:
|
||||
@@ -78,9 +63,7 @@ class LocalePrefixPattern:
|
||||
def regex(self): ...
|
||||
@property
|
||||
def language_prefix(self) -> str: ...
|
||||
def match(
|
||||
self, path: str
|
||||
) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||
def match(self, path: str) -> Optional[Tuple[str, Tuple, Dict[Any, Any]]]: ...
|
||||
def check(self) -> List[Any]: ...
|
||||
def describe(self) -> str: ...
|
||||
|
||||
@@ -104,10 +87,7 @@ class URLPattern:
|
||||
callback: Callable,
|
||||
default_args: Optional[
|
||||
Union[
|
||||
Dict[str, Dict[str, Type[FlatPageSitemap]]],
|
||||
Dict[str, Dict[str, Sitemap]],
|
||||
Dict[str, OrderedDict],
|
||||
Dict[str, str],
|
||||
Dict[str, Dict[str, Type[FlatPageSitemap]]], Dict[str, Dict[str, Sitemap]], Dict[str, OrderedDict], Dict[str, str]
|
||||
]
|
||||
] = ...,
|
||||
name: Optional[str] = ...,
|
||||
@@ -119,10 +99,7 @@ class URLPattern:
|
||||
class URLResolver:
|
||||
url_patterns: List[Tuple[str, Callable]]
|
||||
urlconf_module: Optional[Union[List[Tuple[str, Callable]], Type[Any]]]
|
||||
pattern: Union[
|
||||
django.urls.resolvers.CheckURLMixin,
|
||||
django.urls.resolvers.LocalePrefixPattern,
|
||||
] = ...
|
||||
pattern: Union[django.urls.resolvers.CheckURLMixin, django.urls.resolvers.LocalePrefixPattern] = ...
|
||||
urlconf_name: Optional[
|
||||
Union[
|
||||
List[List[Any]],
|
||||
@@ -141,18 +118,9 @@ class URLResolver:
|
||||
self,
|
||||
pattern: Union[CheckURLMixin, LocalePrefixPattern],
|
||||
urlconf_name: Optional[
|
||||
Union[
|
||||
List[List[Any]],
|
||||
List[Tuple[str, Callable]],
|
||||
List[URLPattern],
|
||||
List[URLResolver],
|
||||
Type[Any],
|
||||
str,
|
||||
]
|
||||
Union[List[List[Any]], List[Tuple[str, Callable]], List[URLPattern], List[URLResolver], Type[Any], str]
|
||||
],
|
||||
default_kwargs: Optional[
|
||||
Union[Dict[str, Dict[Any, Any]], Dict[str, str]]
|
||||
] = ...,
|
||||
default_kwargs: Optional[Union[Dict[str, Dict[Any, Any]], Dict[str, str]]] = ...,
|
||||
app_name: Optional[str] = ...,
|
||||
namespace: Optional[str] = ...,
|
||||
) -> None: ...
|
||||
@@ -164,11 +132,7 @@ class URLResolver:
|
||||
@property
|
||||
def app_dict(self) -> Dict[str, List[str]]: ...
|
||||
def resolve(self, path: str) -> ResolverMatch: ...
|
||||
def urlconf_module(
|
||||
self
|
||||
) -> Optional[Union[List[Tuple[str, Callable]], Type[Any]]]: ...
|
||||
def urlconf_module(self) -> Optional[Union[List[Tuple[str, Callable]], Type[Any]]]: ...
|
||||
def url_patterns(self) -> List[Tuple[str, Callable]]: ...
|
||||
def resolve_error_handler(
|
||||
self, view_type: int
|
||||
) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||
def resolve_error_handler(self, view_type: int) -> Tuple[Callable, Dict[Any, Any]]: ...
|
||||
def reverse(self, lookup_view: str, *args: Any, **kwargs: Any) -> str: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Any, Callable, Optional, Tuple, Union
|
||||
|
||||
|
||||
def get_callable(lookup_view: Union[Callable, str]) -> Callable: ...
|
||||
def get_mod_func(callback: str) -> Tuple[str, str]: ...
|
||||
|
||||
Reference in New Issue
Block a user