Skip to content

lowercase list and dict for 3rd party stubs #5893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions stubs/Jinja2/jinja2/nodes.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import typing
from typing import Any

class Impossible(Exception): ...
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stubs/Pygments/pygments/token.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of a false positive but doesn't really matter

STANDARD_TYPES: Mapping[_TokenType, str]
26 changes: 13 additions & 13 deletions stubs/Werkzeug/werkzeug/http.pyi
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
26 changes: 14 additions & 12 deletions stubs/decorator/decorator.pyi
Original file line number Diff line number Diff line change
@@ -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])
Expand All @@ -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: ...

Expand All @@ -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 = ...,
Expand All @@ -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 = ...,
Expand Down
4 changes: 2 additions & 2 deletions stubs/frozendict/frozendict.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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")
_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
Expand Down
6 changes: 3 additions & 3 deletions stubs/requests/requests/models.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: ...