Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,7 +1,7 @@
import sys
from _typeshed import StrPath
from http.client import HTTPResponse
from typing import ClassVar, Iterable, Iterator, Pattern, Sequence, Tuple, TypeVar, overload
from typing import ClassVar, Iterable, Iterator, Pattern, Sequence, TypeVar, overload
from urllib.request import Request
_T = TypeVar("_T")
@@ -102,10 +102,10 @@ class DefaultCookiePolicy(CookiePolicy):
strict_ns_set_initial_dollar: bool = ...,
strict_ns_set_path: bool = ...,
) -> None: ...
def blocked_domains(self) -> Tuple[str, ...]: ...
def blocked_domains(self) -> tuple[str, ...]: ...
def set_blocked_domains(self, blocked_domains: Sequence[str]) -> None: ...
def is_blocked(self, domain: str) -> bool: ...
def allowed_domains(self) -> Tuple[str, ...] | None: ...
def allowed_domains(self) -> tuple[str, ...] | None: ...
def set_allowed_domains(self, allowed_domains: Sequence[str] | None) -> None: ...
def is_not_allowed(self, domain: str) -> bool: ...
def set_ok_version(self, cookie: Cookie, request: Request) -> bool: ... # undocumented

View File

@@ -1,5 +1,5 @@
import sys
from typing import Any, Dict, Generic, Iterable, Mapping, TypeVar, Union, overload
from typing import Any, Generic, Iterable, Mapping, TypeVar, Union, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -18,7 +18,7 @@ def _unquote(str: str) -> str: ...
class CookieError(Exception): ...
class Morsel(Dict[str, Any], Generic[_T]):
class Morsel(dict[str, Any], Generic[_T]):
value: str
coded_value: _T
key: str
@@ -40,7 +40,7 @@ class Morsel(Dict[str, Any], Generic[_T]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]):
class BaseCookie(dict[str, Morsel[_T]], Generic[_T]):
def __init__(self, input: _DataType | None = ...) -> None: ...
def value_decode(self, val: str) -> _T: ...
def value_encode(self, val: _T) -> str: ...