Skip to content

Commit 191aac3

Browse files
authored
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
1 parent 64903b8 commit 191aac3

File tree

6 files changed

+36
-35
lines changed

6 files changed

+36
-35
lines changed

stubs/Jinja2/jinja2/nodes.pyi

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import typing
21
from typing import Any
32

43
class Impossible(Exception): ...
@@ -56,9 +55,9 @@ class If(Stmt):
5655
class Macro(Stmt):
5756
fields: Any
5857
name: str
59-
args: typing.List[Any]
60-
defaults: typing.List[Any]
61-
body: typing.List[Any]
58+
args: list[Any]
59+
defaults: list[Any]
60+
body: list[Any]
6261

6362
class CallBlock(Stmt):
6463
fields: Any

stubs/Pygments/pygments/token.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ Generic: _TokenType
3030
def is_token_subtype(ttype, other): ...
3131
def string_to_tokentype(s): ...
3232

33-
# Dict, but shouldn't be mutated
33+
# dict, but shouldn't be mutated
3434
STANDARD_TYPES: Mapping[_TokenType, str]

stubs/Werkzeug/werkzeug/http.pyi

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from _typeshed.wsgi import WSGIEnvironment
33
from datetime import datetime, timedelta
4-
from typing import Any, Callable, Dict, Iterable, List, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload
4+
from typing import Any, Callable, Iterable, Mapping, SupportsInt, Text, Tuple, Type, TypeVar, Union, overload
55

66
from .datastructures import (
77
Accept,
@@ -29,41 +29,41 @@ else:
2929
_T = TypeVar("_T")
3030
_U = TypeVar("_U")
3131

32-
HTTP_STATUS_CODES: Dict[int, str]
32+
HTTP_STATUS_CODES: dict[int, str]
3333

3434
def wsgi_to_bytes(data: bytes | Text) -> bytes: ...
3535
def bytes_to_wsgi(data: bytes) -> str: ...
3636
def quote_header_value(value: Any, extra_chars: str = ..., allow_token: bool = ...) -> str: ...
3737
def unquote_header_value(value: _Str, is_filename: bool = ...) -> _Str: ...
3838
def dump_options_header(header: _Str | None, options: Mapping[_Str, Any]) -> _Str: ...
39-
def dump_header(iterable: Iterable[Any] | Dict[_Str, Any], allow_token: bool = ...) -> _Str: ...
40-
def parse_list_header(value: _Str) -> List[_Str]: ...
39+
def dump_header(iterable: Iterable[Any] | dict[_Str, Any], allow_token: bool = ...) -> _Str: ...
40+
def parse_list_header(value: _Str) -> list[_Str]: ...
4141
@overload
42-
def parse_dict_header(value: bytes | Text) -> Dict[Text, Text | None]: ...
42+
def parse_dict_header(value: bytes | Text) -> dict[Text, Text | None]: ...
4343
@overload
4444
def parse_dict_header(value: bytes | Text, cls: Type[_T]) -> _T: ...
4545
@overload
46-
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, Dict[str, str | None]]: ...
46+
def parse_options_header(value: None, multiple: bool = ...) -> Tuple[str, dict[str, str | None]]: ...
4747
@overload
48-
def parse_options_header(value: _Str) -> Tuple[_Str, Dict[_Str, _Str | None]]: ...
48+
def parse_options_header(value: _Str) -> Tuple[_Str, dict[_Str, _Str | None]]: ...
4949

50-
# actually returns Tuple[_Str, Dict[_Str, _Str | None], ...]
50+
# actually returns Tuple[_Str, dict[_Str, _Str | None], ...]
5151
@overload
5252
def parse_options_header(value: _Str, multiple: bool = ...) -> Tuple[Any, ...]: ...
5353
@overload
5454
def parse_accept_header(value: Text | None) -> Accept: ...
5555
@overload
56-
def parse_accept_header(value: _Str | None, cls: Callable[[List[Tuple[str, float]] | None], _T]) -> _T: ...
56+
def parse_accept_header(value: _Str | None, cls: Callable[[list[Tuple[str, float]] | None], _T]) -> _T: ...
5757
@overload
5858
def parse_cache_control_header(
5959
value: None | bytes | Text, on_update: Callable[[RequestCacheControl], Any] | None = ...
6060
) -> RequestCacheControl: ...
6161
@overload
6262
def parse_cache_control_header(
63-
value: None | bytes | Text, on_update: _T, cls: Callable[[Dict[Text, Text | None], _T], _U]
63+
value: None | bytes | Text, on_update: _T, cls: Callable[[dict[Text, Text | None], _T], _U]
6464
) -> _U: ...
6565
@overload
66-
def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[Dict[Text, Text | None], None], _U]) -> _U: ...
66+
def parse_cache_control_header(value: None | bytes | Text, *, cls: Callable[[dict[Text, Text | None], None], _U]) -> _U: ...
6767
def parse_set_header(value: Text, on_update: Callable[[HeaderSet], Any] | None = ...) -> HeaderSet: ...
6868
def parse_authorization_header(value: None | bytes | Text) -> Authorization | None: ...
6969
def parse_www_authenticate_header(
@@ -90,8 +90,8 @@ def is_resource_modified(
9090
last_modified: None | Text | datetime = ...,
9191
ignore_if_range: bool = ...,
9292
) -> bool: ...
93-
def remove_entity_headers(headers: List[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
94-
def remove_hop_by_hop_headers(headers: List[Tuple[Text, Text]] | Headers) -> None: ...
93+
def remove_entity_headers(headers: list[Tuple[Text, Text]] | Headers, allowed: Iterable[Text] = ...) -> None: ...
94+
def remove_hop_by_hop_headers(headers: list[Tuple[Text, Text]] | Headers) -> None: ...
9595
def is_entity_header(header: Text) -> bool: ...
9696
def is_hop_by_hop_header(header: Text) -> bool: ...
9797
@overload

stubs/decorator/decorator.pyi

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Any, Callable, Dict, Iterator, List, NamedTuple, Pattern, Text, Tuple, TypeVar
2+
from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar
33

44
_C = TypeVar("_C", bound=Callable[..., Any])
55
_Func = TypeVar("_Func", bound=Callable[..., Any])
@@ -11,13 +11,13 @@ if sys.version_info >= (3,):
1111
from inspect import getfullargspec as getfullargspec, iscoroutinefunction as iscoroutinefunction
1212
else:
1313
class FullArgSpec(NamedTuple):
14-
args: List[str]
14+
args: list[str]
1515
varargs: str | None
1616
varkw: str | None
1717
defaults: Tuple[Any, ...]
18-
kwonlyargs: List[str]
19-
kwonlydefaults: Dict[str, Any]
20-
annotations: Dict[str, Any]
18+
kwonlyargs: list[str]
19+
kwonlydefaults: dict[str, Any]
20+
annotations: dict[str, Any]
2121
def iscoroutinefunction(f: Callable[..., Any]) -> bool: ...
2222
def getfullargspec(func: Any) -> FullArgSpec: ...
2323

@@ -28,20 +28,22 @@ else:
2828

2929
DEF: Pattern[str]
3030

31+
_dict = dict # conflicts with attribute name
32+
3133
class FunctionMaker(object):
32-
args: List[Text]
34+
args: list[Text]
3335
varargs: Text | None
3436
varkw: Text | None
3537
defaults: Tuple[Any, ...]
36-
kwonlyargs: List[Text]
38+
kwonlyargs: list[Text]
3739
kwonlydefaults: Text | None
3840
shortsignature: Text | None
3941
name: Text
4042
doc: Text | None
4143
module: Text | None
42-
annotations: Dict[Text, Any]
44+
annotations: _dict[Text, Any]
4345
signature: Text
44-
dict: Dict[Text, Any]
46+
dict: _dict[Text, Any]
4547
def __init__(
4648
self,
4749
func: Callable[..., Any] | None = ...,
@@ -50,18 +52,18 @@ class FunctionMaker(object):
5052
defaults: Tuple[Any, ...] | None = ...,
5153
doc: Text | None = ...,
5254
module: Text | None = ...,
53-
funcdict: Dict[Text, Any] | None = ...,
55+
funcdict: _dict[Text, Any] | None = ...,
5456
) -> None: ...
5557
def update(self, func: Any, **kw: Any) -> None: ...
5658
def make(
57-
self, src_templ: Text, evaldict: Dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any
59+
self, src_templ: Text, evaldict: _dict[Text, Any] | None = ..., addsource: bool = ..., **attrs: Any
5860
) -> Callable[..., Any]: ...
5961
@classmethod
6062
def create(
6163
cls,
6264
obj: Any,
6365
body: Text,
64-
evaldict: Dict[Text, Any],
66+
evaldict: _dict[Text, Any],
6567
defaults: Tuple[Any, ...] | None = ...,
6668
doc: Text | None = ...,
6769
module: Text | None = ...,

stubs/frozendict/frozendict.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import collections
2-
from typing import Any, Dict, Generic, Iterable, Iterator, Mapping, Tuple, Type, TypeVar, overload
2+
from typing import Any, Generic, Iterable, Iterator, Mapping, Tuple, Type, TypeVar, overload
33

44
_S = TypeVar("_S")
55
_KT = TypeVar("_KT")
66
_VT = TypeVar("_VT")
77

88
class frozendict(Mapping[_KT, _VT], Generic[_KT, _VT]):
99

10-
dict_cls: Type[Dict[Any, Any]] = ...
10+
dict_cls: Type[dict[Any, Any]] = ...
1111
@overload
1212
def __init__(self, **kwargs: _VT) -> None: ...
1313
@overload

stubs/requests/requests/models.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
from json import JSONDecoder
3-
from typing import Any, Callable, Dict, Iterator, List, Text, Type
3+
from typing import Any, Callable, Iterator, Text, Type
44

55
from . import auth, cookies, exceptions, hooks, status_codes, structures, utils
66
from .cookies import RequestsCookieJar
@@ -94,7 +94,7 @@ class Response:
9494
raw: Any
9595
url: str
9696
encoding: str
97-
history: List[Response]
97+
history: list[Response]
9898
reason: str
9999
cookies: RequestsCookieJar
100100
elapsed: datetime.timedelta
@@ -135,6 +135,6 @@ class Response:
135135
**kwds: Any,
136136
) -> Any: ...
137137
@property
138-
def links(self) -> Dict[Any, Any]: ...
138+
def links(self) -> dict[Any, Any]: ...
139139
def raise_for_status(self) -> None: ...
140140
def close(self) -> None: ...

0 commit comments

Comments
 (0)