mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-02-21 00:58:29 +08:00
improved version
This commit is contained in:
@@ -9,7 +9,7 @@ from typing import (
|
||||
def check_errors(fn: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def clean_files(filelist: Union[List[Union[None, bool]], List[str], List[Union[None, str]]]) -> List[str]: ...
|
||||
def clean_files(filelist: Union[List[Union[None, str]], List[str], List[Union[None, bool]]]) -> List[str]: ...
|
||||
|
||||
|
||||
def gen_filenames(only_new: bool = ...) -> List[str]: ...
|
||||
|
||||
@@ -80,7 +80,7 @@ def has_vary_header(response: HttpResponse, header_query: str) -> bool: ...
|
||||
def learn_cache_key(
|
||||
request: WSGIRequest,
|
||||
response: HttpResponse,
|
||||
cache_timeout: Optional[Union[float, int]] = ...,
|
||||
cache_timeout: Optional[float] = ...,
|
||||
key_prefix: Optional[str] = ...,
|
||||
cache: Optional[Union[DefaultCacheProxy, backends.locmem.LocMemCache]] = ...
|
||||
) -> str: ...
|
||||
@@ -94,7 +94,7 @@ def patch_response_headers(response: HttpResponse, cache_timeout: int = ...) ->
|
||||
|
||||
def patch_vary_headers(
|
||||
response: HttpResponseBase,
|
||||
newheaders: Union[Tuple[str], Tuple[str, str]]
|
||||
newheaders: Union[Tuple[str, str], Tuple[str]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ from datetime import (
|
||||
from typing import Union
|
||||
|
||||
|
||||
def format(value: Union[time, str, date], format_string: str) -> str: ...
|
||||
def format(value: Union[time, date, str], format_string: str) -> str: ...
|
||||
|
||||
|
||||
def time_format(value: Union[date, time, str], format_string: str) -> str: ...
|
||||
def time_format(value: Union[str, time, date], format_string: str) -> str: ...
|
||||
|
||||
|
||||
class DateFormat:
|
||||
@@ -41,7 +41,7 @@ class TimeFormat:
|
||||
def P(self) -> str: ...
|
||||
def T(self) -> str: ...
|
||||
def Z(self) -> Union[str, int]: ...
|
||||
def __init__(self, obj: Union[time, date, str]) -> None: ...
|
||||
def __init__(self, obj: Union[time, str, date]) -> None: ...
|
||||
def a(self) -> str: ...
|
||||
def e(self) -> str: ...
|
||||
def f(self) -> Union[str, int]: ...
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
from django.middleware.cache import CacheMiddleware
|
||||
from django.middleware.csrf import CsrfViewMiddleware
|
||||
from django.test.testcases import LiveServerTestCase
|
||||
from django.views.generic.base import View
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Optional,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
@@ -21,17 +24,25 @@ def decorator_from_middleware(middleware_class: Type[CsrfViewMiddleware]) -> Cal
|
||||
def decorator_from_middleware_with_args(middleware_class: Type[CacheMiddleware]) -> Callable: ...
|
||||
|
||||
|
||||
def make_middleware_decorator(middleware_class: Any) -> Callable: ...
|
||||
def make_middleware_decorator(middleware_class: Type[object]) -> Callable: ...
|
||||
|
||||
|
||||
def method_decorator(decorator: Callable, name: str = ...) -> Callable: ...
|
||||
|
||||
|
||||
class classonlymethod:
|
||||
def __get__(self, instance: None, cls: Any = ...) -> Callable: ...
|
||||
def __get__(
|
||||
self,
|
||||
instance: None,
|
||||
cls: Type[Union[View, PermissionRequiredMixin]] = ...
|
||||
) -> Callable: ...
|
||||
|
||||
|
||||
class classproperty:
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> str: ...
|
||||
def __get__(
|
||||
self,
|
||||
instance: Optional[LiveServerTestCase],
|
||||
cls: Type[LiveServerTestCase] = ...
|
||||
) -> str: ...
|
||||
def __init__(self, method: Callable = ...) -> None: ...
|
||||
def getter(self, method: Callable) -> classproperty: ...
|
||||
@@ -1,4 +1,5 @@
|
||||
from datetime import date
|
||||
from django.db.models.base import Model
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
@@ -35,7 +36,12 @@ def is_protected_type(obj: Any) -> bool: ...
|
||||
def repercent_broken_unicode(path: bytes) -> bytes: ...
|
||||
|
||||
|
||||
def smart_text(s: Any, encoding: str = ..., strings_only: bool = ..., errors: str = ...) -> str: ...
|
||||
def smart_text(
|
||||
s: Union[Model, int, str],
|
||||
encoding: str = ...,
|
||||
strings_only: bool = ...,
|
||||
errors: str = ...
|
||||
) -> str: ...
|
||||
|
||||
|
||||
def uri_to_iri(uri: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
@@ -32,14 +32,14 @@ def get_format_modules(lang: str = ..., reverse: bool = ...) -> List[Any]: ...
|
||||
def iter_format_modules(lang: str, format_module_path: Optional[str] = ...) -> Iterator[Any]: ...
|
||||
|
||||
|
||||
def localize(value: Any, use_l10n: Optional[bool] = ...) -> Any: ...
|
||||
def localize(value: object, use_l10n: Optional[bool] = ...) -> object: ...
|
||||
|
||||
|
||||
def localize_input(value: Any, default: Optional[str] = ...) -> Optional[str]: ...
|
||||
|
||||
|
||||
def number_format(
|
||||
value: Union[Decimal, float, str, int],
|
||||
value: Union[float, Decimal, str],
|
||||
decimal_pos: Optional[int] = ...,
|
||||
use_l10n: Optional[bool] = ...,
|
||||
force_grouping: bool = ...
|
||||
@@ -53,7 +53,7 @@ def sanitize_separators(value: Union[str, int]) -> Union[str, int]: ...
|
||||
|
||||
|
||||
def time_format(
|
||||
value: Union[date, time, str],
|
||||
value: Union[str, time, date],
|
||||
format: Optional[str] = ...,
|
||||
use_l10n: None = ...
|
||||
) -> str: ...
|
||||
@@ -1,15 +1,22 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.base import Model
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
class LazyObject:
|
||||
def __delattr__(self, name: str) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
def __reduce__(self) -> Any: ...
|
||||
def __reduce__(
|
||||
self
|
||||
) -> Union[Tuple[Callable, Tuple[object]], Tuple[Callable, Tuple[User]], Tuple[Callable, Tuple[Model]]]: ...
|
||||
def __setattr__(self, name: str, value: object) -> None: ...
|
||||
|
||||
|
||||
@@ -21,4 +28,4 @@ class SimpleLazyObject:
|
||||
|
||||
|
||||
class cached_property:
|
||||
def __get__(self, instance: Any, cls: Any = ...) -> Any: ...
|
||||
def __get__(self, instance: Any, cls: Type[Any] = ...) -> Any: ...
|
||||
@@ -1,3 +1,4 @@
|
||||
from django.db.models.base import Model
|
||||
from django.utils.safestring import SafeText
|
||||
from typing import (
|
||||
Any,
|
||||
@@ -18,7 +19,7 @@ def avoid_wrapping(value: str) -> str: ...
|
||||
def conditional_escape(text: Any) -> str: ...
|
||||
|
||||
|
||||
def escape(text: Any) -> SafeText: ...
|
||||
def escape(text: Optional[Union[Model, int, str]]) -> SafeText: ...
|
||||
|
||||
|
||||
def escapejs(value: str) -> SafeText: ...
|
||||
|
||||
@@ -28,10 +28,10 @@ def base36_to_int(s: str) -> int: ...
|
||||
def cookie_date(epoch_seconds: float = ...) -> str: ...
|
||||
|
||||
|
||||
def http_date(epoch_seconds: Union[float, int] = ...) -> str: ...
|
||||
def http_date(epoch_seconds: float = ...) -> str: ...
|
||||
|
||||
|
||||
def int_to_base36(i: Union[str, int, Dict[int, int]]) -> str: ...
|
||||
def int_to_base36(i: Union[str, Dict[int, int], int]) -> str: ...
|
||||
|
||||
|
||||
def is_safe_url(url: Optional[str], allowed_hosts: Optional[Set[str]], require_https: bool = ...) -> bool: ...
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
from django.core.mail.backends.locmem import EmailBackend
|
||||
from logging import LogRecord
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
List,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
def configure_logging(logging_config: str, logging_settings: Dict[str, Any]) -> None: ...
|
||||
def configure_logging(
|
||||
logging_config: str,
|
||||
logging_settings: Dict[str, Union[int, Dict[str, Dict[str, str]], Dict[str, Dict[str, Union[str, List[str]]]], Dict[str, Dict[str, Union[List[str], str, bool]]]]]
|
||||
) -> None: ...
|
||||
|
||||
|
||||
def log_response(
|
||||
|
||||
@@ -7,10 +7,10 @@ from typing import (
|
||||
|
||||
|
||||
def format(
|
||||
number: Union[float, str, int, Decimal],
|
||||
number: Union[float, Decimal, str],
|
||||
decimal_sep: str,
|
||||
decimal_pos: Optional[int] = ...,
|
||||
grouping: Union[Tuple[int, int, int], int, Tuple[int, int, int, int, int]] = ...,
|
||||
grouping: Union[Tuple[int, int, int, int, int], Tuple[int, int, int], int] = ...,
|
||||
thousand_sep: str = ...,
|
||||
force_grouping: bool = ...,
|
||||
use_l10n: Optional[bool] = ...
|
||||
|
||||
@@ -17,12 +17,12 @@ def contains(
|
||||
def flatten_result(source: Any) -> Union[Tuple[List[str], List[List[str]]], Tuple[List[str], List[List[Any]]]]: ...
|
||||
|
||||
|
||||
def get_quantifier(ch: str, input_iter: Iterator[Any]) -> Union[Tuple[int, None], Tuple[int, str]]: ...
|
||||
def get_quantifier(ch: str, input_iter: Iterator[Any]) -> Union[Tuple[int, str], Tuple[int, None]]: ...
|
||||
|
||||
|
||||
def normalize(
|
||||
pattern: str
|
||||
) -> Union[List[Tuple[str, List[Any]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]], List[Tuple[str, List[str]]]]: ...
|
||||
) -> Union[List[Tuple[str, List[Any]]], List[Tuple[str, List[str]]], List[Union[Tuple[str, List[Any]], Tuple[str, List[str]]]]]: ...
|
||||
|
||||
|
||||
def walk_to_end(ch: str, input_iter: Iterator[Any]) -> None: ...
|
||||
@@ -9,8 +9,8 @@ def _safety_decorator(safety_marker: Callable, func: Callable) -> Callable: ...
|
||||
|
||||
|
||||
def mark_safe(
|
||||
s: Union[str, Callable, BoundField]
|
||||
) -> Union[SafeText, Callable, BoundField]: ...
|
||||
s: Union[str, BoundField, Callable]
|
||||
) -> Union[SafeText, BoundField, Callable]: ...
|
||||
|
||||
|
||||
class SafeData:
|
||||
|
||||
@@ -10,5 +10,5 @@ class _SixMetaPathImporter:
|
||||
def find_module(
|
||||
self,
|
||||
fullname: str,
|
||||
path: Optional[Union[List[str], _NamespacePath]] = ...
|
||||
path: Optional[Union[_NamespacePath, List[str]]] = ...
|
||||
) -> None: ...
|
||||
@@ -15,4 +15,4 @@ def make_style(opts: Tuple = ..., **kwargs) -> Callable: ...
|
||||
|
||||
def parse_color_setting(
|
||||
config_string: str
|
||||
) -> Optional[Union[Dict[str, Dict[str, str]], Dict[str, Dict[str, Union[str, Tuple[str]]]]]]: ...
|
||||
) -> Optional[Union[Dict[str, Dict[str, Union[str, Tuple[str]]]], Dict[str, Dict[str, str]]]]: ...
|
||||
@@ -16,7 +16,7 @@ def camel_case_to_spaces(value: str) -> str: ...
|
||||
def capfirst(x: Optional[str]) -> Optional[str]: ...
|
||||
|
||||
|
||||
def compress_sequence(sequence: Union[List[bytes], map]) -> Iterator[bytes]: ...
|
||||
def compress_sequence(sequence: Union[map, List[bytes]]) -> Iterator[bytes]: ...
|
||||
|
||||
|
||||
def compress_string(s: bytes) -> bytes: ...
|
||||
|
||||
@@ -4,7 +4,6 @@ from datetime import (
|
||||
timedelta,
|
||||
)
|
||||
from typing import (
|
||||
Any,
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
@@ -13,7 +12,7 @@ from typing import (
|
||||
def _get_timezone_name(timezone: FixedOffset) -> str: ...
|
||||
|
||||
|
||||
def activate(timezone: Union[str, FixedOffset]) -> None: ...
|
||||
def activate(timezone: Union[FixedOffset, str]) -> None: ...
|
||||
|
||||
|
||||
def deactivate() -> None: ...
|
||||
@@ -53,7 +52,7 @@ def make_naive(value: datetime, timezone: FixedOffset = ...) -> datetime: ...
|
||||
def now() -> datetime: ...
|
||||
|
||||
|
||||
def template_localtime(value: Any, use_tz: Optional[bool] = ...) -> Any: ...
|
||||
def template_localtime(value: object, use_tz: Optional[bool] = ...) -> object: ...
|
||||
|
||||
|
||||
class FixedOffset:
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from typing import (
|
||||
Optional,
|
||||
Union,
|
||||
)
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def activate(language: str) -> None: ...
|
||||
@@ -38,7 +35,7 @@ def gettext(message: str) -> str: ...
|
||||
def gettext_noop(message: str) -> str: ...
|
||||
|
||||
|
||||
def ngettext(singular: str, plural: str, number: Union[float, int]) -> str: ...
|
||||
def ngettext(singular: str, plural: str, number: float) -> str: ...
|
||||
|
||||
|
||||
def npgettext(context: str, singular: str, plural: str, number: int) -> str: ...
|
||||
|
||||
@@ -5,7 +5,6 @@ from typing import (
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
@@ -24,7 +23,7 @@ def deactivate() -> None: ...
|
||||
def deactivate_all() -> None: ...
|
||||
|
||||
|
||||
def do_ntranslate(singular: str, plural: str, number: Union[float, int], translation_function: str) -> str: ...
|
||||
def do_ntranslate(singular: str, plural: str, number: float, translation_function: str) -> str: ...
|
||||
|
||||
|
||||
def get_language() -> Optional[str]: ...
|
||||
@@ -51,7 +50,7 @@ def gettext(message: str) -> str: ...
|
||||
def gettext_noop(message: str) -> str: ...
|
||||
|
||||
|
||||
def ngettext(singular: str, plural: str, number: Union[float, int]) -> str: ...
|
||||
def ngettext(singular: str, plural: str, number: float) -> str: ...
|
||||
|
||||
|
||||
def npgettext(context: str, singular: str, plural: str, number: int) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user