mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-23 04:11:28 +08:00
lowercase list and dict for 3rd party stubs (#5893)
* stubs/decorator/decorator.pyi * stubs/frozendict/frozendict.pyi * stubs/Jinja2/jinja2/nodes.pyi * stubs/Pygments/pygments/token.pyi * stubs/requests/requests/models.pyi * stubs/Werkzeug/werkzeug/http.pyi
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import typing
|
||||
from typing import Any
|
||||
|
||||
class Impossible(Exception): ...
|
||||
@@ -56,9 +55,9 @@ class If(Stmt):
|
||||
class Macro(Stmt):
|
||||
fields: Any
|
||||
name: str
|
||||
args: typing.List[Any]
|
||||
defaults: typing.List[Any]
|
||||
body: typing.List[Any]
|
||||
args: list[Any]
|
||||
defaults: list[Any]
|
||||
body: list[Any]
|
||||
|
||||
class CallBlock(Stmt):
|
||||
fields: Any
|
||||
|
||||
@@ -30,5 +30,5 @@ Generic: _TokenType
|
||||
def is_token_subtype(ttype, other): ...
|
||||
def string_to_tokentype(s): ...
|
||||
|
||||
# Dict, but shouldn't be mutated
|
||||
# dict, but shouldn't be mutated
|
||||
STANDARD_TYPES: Mapping[_TokenType, str]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed.wsgi import WSGIEnvironment
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload
|
||||
from typing import Any, Callable, Iterable, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload
|
||||
|
||||
from .datastructures import (
|
||||
Accept,
|
||||
@@ -29,41 +29,41 @@ else:
|
||||
_T = TypeVar("_T")
|
||||
_U = TypeVar("_U")
|
||||
|
||||
HTTP_STATUS_CODES: Dict[int, str]
|
||||
HTTP_STATUS_CODES: dict[int, str]
|
||||
|
||||
def wsgi_to_bytes(data: bytes | Text) -> bytes: ...
|
||||
def bytes_to_wsgi(data: bytes) -> str: ...
|
||||
def quote_header_value(value: Any, extra_chars: str = ..., allow_token: bool = ...) -> str: ...
|
||||
def unquote_header_value(value: _Str, is_filename: bool = ...) -> _Str: ...
|
||||
def dump_options_header(header: _Str | None, options: Mapping[_Str, Any]) -> _Str: ...
|
||||
def dump_header(iterable: Iterable[Any] | Dict[_Str, Any], allow_token: bool = ...) -> _Str: ...
|
||||
def parse_list_header(value: _Str) -> List[_Str]: ...
|
||||
def dump_header(iterable: Iterable[Any] | dict[_Str, Any], allow_token: bool = ...) -> _Str: ...
|
||||
def parse_list_header(value: _Str) -> list[_Str]: ...
|
||||
@overload
|
||||
def parse_dict_header(value: bytes | Text) -> Dict[Text, Text | None]: ...
|
||||
def parse_dict_header(value: bytes | Text) -> dict[Text, Text | None]: ...
|
||||
@overload
|
||||
def parse_dict_header(value: bytes | Text, cls: Type[_T]) -> _T: ...
|
||||
@overload
|
||||
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, Dict[str, str | None]]: ...
|
||||
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, dict[str, str | None]]: ...
|
||||
@overload
|
||||
def parse_options_header(value: _Str) -> Tuple[_Str, Dict[_Str, _Str | None]]: ...
|
||||
def parse_options_header(value: _Str) -> Tuple[_Str, dict[_Str, _Str | None]]: ...
|
||||
|
||||
# actually returns Tuple[_Str, Dict[_Str, _Str | None], ...]
|
||||
# actually returns Tuple[_Str, dict[_Str, _Str | None], ...]
|
||||
@overload
|
||||
def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: ...
|
||||
@overload
|
||||
def parse_accept_header(value: Text | None) -> Accept: ...
|
||||
@overload
|
||||
def parse_accept_header(value: _Str | None, cls: Callable[[List[Tuple[str, float]] | None], _T]) -> _T: ...
|
||||
def parse_accept_header(value: _Str | None, cls: Callable[[list[Tuple[str, float]] | None], _T]) -> _T: ...
|
||||
@overload
|
||||
def parse_cache_control_header(
|
||||
value: None | bytes | Text, on_update: Callable[[RequestCacheControl], Any] | None = ...
|
||||
) -> RequestCacheControl: ...
|
||||
@overload
|
||||
def parse_cache_control_header(
|
||||
value: None | bytes | Text, on_update: _T, cls: Callable[[Dict[Text, Text | None], _T], _U]
|
||||
value: None | bytes | Text, on_update: _T, cls: Callable[[dict[Text, Text | None], _T], _U]
|
||||
) -> _U: ...
|
||||
@overload
|
||||
def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[Dict[Text, Text | None], None], _U]) -> _U: ...
|
||||
def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[dict[Text, Text | None], None], _U]) -> _U: ...
|
||||
def parse_set_header(value: Text, on_update: Callable[[HeaderSet], Any] | None = ...) -> HeaderSet: ...
|
||||
def parse_authorization_header(value: None | bytes | Text) -> Authorization | None: ...
|
||||
def parse_www_authenticate_header(
|
||||
@@ -90,8 +90,8 @@ def is_resource_modified(
|
||||
last_modified: None | Text | datetime = ...,
|
||||
ignore_if_range: bool = ...,
|
||||
) -> bool: ...
|
||||
def remove_entity_headers(headers: List[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
|
||||
def remove_hop_by_hop_headers(headers: List[Tuple[Text, Text]] | Headers) -> None: ...
|
||||
def remove_entity_headers(headers: list[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
|
||||
def remove_hop_by_hop_headers(headers: list[Tuple[Text, Text]] | Headers) -> None: ...
|
||||
def is_entity_header(header: Text) -> bool: ...
|
||||
def is_hop_by_hop_header(header: Text) -> bool: ...
|
||||
@overload
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Dict, Iterator, List, NamedTuple, Pattern, Text, Tuple, TypeVar
|
||||
from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar
|
||||
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
_Func = TypeVar("_Func", bound=Callable[..., Any])
|
||||
@@ -11,13 +11,13 @@ if sys.version_info >= (3,):
|
||||
from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
|
||||
else:
|
||||
class FullArgSpec(NamedTuple):
|
||||
args: List[str]
|
||||
args: list[str]
|
||||
varargs: str | None
|
||||
varkw: str | None
|
||||
defaults: Tuple[Any, ...]
|
||||
kwonlyargs: List[str]
|
||||
kwonlydefaults: Dict[str, Any]
|
||||
annotations: Dict[str, Any]
|
||||
kwonlyargs: list[str]
|
||||
kwonlydefaults: dict[str, Any]
|
||||
annotations: dict[str, Any]
|
||||
def iscoroutinefunction(f: Callable[..., Any]) -> bool: ...
|
||||
def getfullargspec(func: Any) -> FullArgSpec: ...
|
||||
|
||||
@@ -28,20 +28,22 @@ else:
|
||||
|
||||
DEF: Pattern[str]
|
||||
|
||||
_dict = dict # conflicts with attribute name
|
||||
|
||||
class FunctionMaker(object):
|
||||
args: List[Text]
|
||||
args: list[Text]
|
||||
varargs: Text | None
|
||||
varkw: Text | None
|
||||
defaults: Tuple[Any, ...]
|
||||
kwonlyargs: List[Text]
|
||||
kwonlyargs: list[Text]
|
||||
kwonlydefaults: Text | None
|
||||
shortsignature: Text | None
|
||||
name: Text
|
||||
doc: Text | None
|
||||
module: Text | None
|
||||
annotations: Dict[Text, Any]
|
||||
annotations: _dict[Text, Any]
|
||||
signature: Text
|
||||
dict: Dict[Text, Any]
|
||||
dict: _dict[Text, Any]
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable[..., Any] | None = ...,
|
||||
@@ -50,18 +52,18 @@ class FunctionMaker(object):
|
||||
defaults: Tuple[Any, ...] | None = ...,
|
||||
doc: Text | None = ...,
|
||||
module: Text | None = ...,
|
||||
funcdict: Dict[Text, Any] | None = ...,
|
||||
funcdict: _dict[Text, Any] | None = ...,
|
||||
) -> None: ...
|
||||
def update(self, func: Any, **kw: Any) -> None: ...
|
||||
def make(
|
||||
self, src_templ: Text, evaldict: Dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any
|
||||
self, src_templ: Text, evaldict: _dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any
|
||||
) -> Callable[..., Any]: ...
|
||||
@classmethod
|
||||
def create(
|
||||
cls,
|
||||
obj: Any,
|
||||
body: Text,
|
||||
evaldict: Dict[Text, Any],
|
||||
evaldict: _dict[Text, Any],
|
||||
defaults: Tuple[Any, ...] | None = ...,
|
||||
doc: Text | None = ...,
|
||||
module: Text | None = ...,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import collections
|
||||
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, Tuple, Type, TypeVar, overload
|
||||
from typing import Any, Generic, Iterable, Iterator, Mapping, Tuple, Type, TypeVar, overload
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -7,7 +7,7 @@ _VT = TypeVar("_VT")
|
||||
|
||||
class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
|
||||
dict_cls: Type[Dict[Any, Any]] = ...
|
||||
dict_cls: Type[dict[Any, Any]] = ...
|
||||
@overload
|
||||
def __init__(self, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
from json import JSONDecoder
|
||||
from typing import Any, Callable, Dict, Iterator, List, Text, Type
|
||||
from typing import Any, Callable, Iterator, Text, Type
|
||||
|
||||
from . import auth, cookies, exceptions, hooks, status_codes, structures, utils
|
||||
from .cookies import RequestsCookieJar
|
||||
@@ -94,7 +94,7 @@ class Response:
|
||||
raw: Any
|
||||
url: str
|
||||
encoding: str
|
||||
history: List[Response]
|
||||
history: list[Response]
|
||||
reason: str
|
||||
cookies: RequestsCookieJar
|
||||
elapsed: datetime.timedelta
|
||||
@@ -135,6 +135,6 @@ class Response:
|
||||
**kwds: Any,
|
||||
) -> Any: ...
|
||||
@property
|
||||
def links(self) -> Dict[Any, Any]: ...
|
||||
def links(self) -> dict[Any, Any]: ...
|
||||
def raise_for_status(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user