mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Use str instead of typing.Text (#7629)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import logging
|
||||
from typing import Any, Text
|
||||
from typing import Any
|
||||
|
||||
from .api import (
|
||||
delete as delete,
|
||||
@@ -36,4 +36,4 @@ __version__: Any
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record): ...
|
||||
|
||||
def check_compatibility(urllib3_version: Text, chardet_version: Text | None, charset_normalizer_version: Text | None) -> None: ...
|
||||
def check_compatibility(urllib3_version: str, chardet_version: str | None, charset_normalizer_version: str | None) -> None: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Mapping, Text
|
||||
from typing import Any, Mapping
|
||||
|
||||
from urllib3 import exceptions as urllib3_exceptions, poolmanager, response
|
||||
from urllib3.util import retry
|
||||
@@ -43,7 +43,7 @@ class BaseAdapter:
|
||||
stream: bool = ...,
|
||||
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
|
||||
verify: bool | str = ...,
|
||||
cert: None | bytes | Text | tuple[bytes | Text, bytes | Text] = ...,
|
||||
cert: None | bytes | str | tuple[bytes | str, bytes | str] = ...,
|
||||
proxies: Mapping[str, str] | None = ...,
|
||||
) -> Response: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -72,6 +72,6 @@ class HTTPAdapter(BaseAdapter):
|
||||
stream: bool = ...,
|
||||
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
|
||||
verify: bool | str = ...,
|
||||
cert: None | bytes | Text | tuple[bytes | Text, bytes | Text] = ...,
|
||||
cert: None | bytes | str | tuple[bytes | str, bytes | str] = ...,
|
||||
proxies: Mapping[str, str] | None = ...,
|
||||
) -> Response: ...
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from typing import Any, Text
|
||||
from typing import Any
|
||||
|
||||
from .models import Response
|
||||
from .sessions import _Data, _Params
|
||||
|
||||
def request(
|
||||
method: Text | bytes,
|
||||
url: Text | bytes,
|
||||
method: str | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -22,7 +22,7 @@ def request(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def get(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -39,7 +39,7 @@ def get(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def options(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -56,7 +56,7 @@ def options(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def head(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -73,7 +73,7 @@ def head(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def post(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
json: Any | None = ...,
|
||||
params: _Params | None = ...,
|
||||
@@ -90,7 +90,7 @@ def post(
|
||||
cert: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def put(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
params: _Params | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -107,7 +107,7 @@ def put(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def patch(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
params: _Params | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -124,7 +124,7 @@ def patch(
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def delete(
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Text
|
||||
from typing import Any
|
||||
|
||||
from . import cookies, models, utils
|
||||
|
||||
@@ -9,7 +9,7 @@ to_native_string = utils.to_native_string
|
||||
CONTENT_TYPE_FORM_URLENCODED: Any
|
||||
CONTENT_TYPE_MULTI_PART: Any
|
||||
|
||||
def _basic_auth_str(username: bytes | Text, password: bytes | Text) -> str: ...
|
||||
def _basic_auth_str(username: bytes | str, password: bytes | str) -> str: ...
|
||||
|
||||
class AuthBase:
|
||||
def __call__(self, r: models.PreparedRequest) -> models.PreparedRequest: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import datetime
|
||||
from _typeshed import Self
|
||||
from json import JSONDecoder
|
||||
from typing import Any, Callable, Iterator, Text, TypeVar
|
||||
from typing import Any, Callable, Iterator, TypeVar
|
||||
|
||||
from urllib3 import exceptions as urllib3_exceptions, fields, filepost, util
|
||||
|
||||
@@ -71,10 +71,10 @@ class Request(RequestHooksMixin):
|
||||
def prepare(self) -> PreparedRequest: ...
|
||||
|
||||
class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):
|
||||
method: str | Text | None
|
||||
url: str | Text | None
|
||||
method: str | None
|
||||
url: str | None
|
||||
headers: CaseInsensitiveDict[str]
|
||||
body: bytes | Text | None
|
||||
body: bytes | str | None
|
||||
hooks: Any
|
||||
def __init__(self) -> None: ...
|
||||
def prepare(
|
||||
@@ -121,7 +121,7 @@ class Response:
|
||||
def apparent_encoding(self) -> str: ...
|
||||
def iter_content(self, chunk_size: int | None = ..., decode_unicode: bool = ...) -> Iterator[Any]: ...
|
||||
def iter_lines(
|
||||
self, chunk_size: int | None = ..., decode_unicode: bool = ..., delimiter: Text | bytes | None = ...
|
||||
self, chunk_size: int | None = ..., decode_unicode: bool = ..., delimiter: str | bytes | None = ...
|
||||
) -> Iterator[Any]: ...
|
||||
@property
|
||||
def content(self) -> bytes: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self, SupportsItems
|
||||
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, Text, TypeVar, Union
|
||||
from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, TypeVar, Union
|
||||
|
||||
from urllib3 import _collections
|
||||
|
||||
@@ -47,32 +47,32 @@ class SessionRedirectMixin:
|
||||
def rebuild_proxies(self, prepared_request, proxies): ...
|
||||
def should_strip_auth(self, old_url, new_url): ...
|
||||
|
||||
_Data = Text | bytes | Mapping[str, Any] | Mapping[Text, Any] | Iterable[tuple[Text, Text | None]] | IO[Any] | None
|
||||
_Data = str | bytes | Mapping[str, Any] | Iterable[tuple[str, str | None]] | IO[Any] | None
|
||||
|
||||
_Hook = Callable[[Response], Any]
|
||||
_Hooks = MutableMapping[Text, _Hook | list[_Hook]]
|
||||
_HooksInput = MutableMapping[Text, Iterable[_Hook] | _Hook]
|
||||
_Hooks = MutableMapping[str, _Hook | list[_Hook]]
|
||||
_HooksInput = MutableMapping[str, Iterable[_Hook] | _Hook]
|
||||
|
||||
_ParamsMappingKeyType = Text | bytes | int | float
|
||||
_ParamsMappingValueType = Text | bytes | int | float | Iterable[Text | bytes | int | float] | None
|
||||
_ParamsMappingKeyType = str | bytes | int | float
|
||||
_ParamsMappingValueType = str | bytes | int | float | Iterable[str | bytes | int | float] | None
|
||||
_Params = Union[
|
||||
SupportsItems[_ParamsMappingKeyType, _ParamsMappingValueType],
|
||||
tuple[_ParamsMappingKeyType, _ParamsMappingValueType],
|
||||
Iterable[tuple[_ParamsMappingKeyType, _ParamsMappingValueType]],
|
||||
Text | bytes,
|
||||
str | bytes,
|
||||
]
|
||||
_TextMapping = MutableMapping[Text, Text]
|
||||
_TextMapping = MutableMapping[str, str]
|
||||
|
||||
class Session(SessionRedirectMixin):
|
||||
__attrs__: Any
|
||||
headers: CaseInsensitiveDict[Text]
|
||||
auth: None | tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest]
|
||||
headers: CaseInsensitiveDict[str]
|
||||
auth: None | tuple[str, str] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest]
|
||||
proxies: _TextMapping
|
||||
hooks: _Hooks
|
||||
params: _Params
|
||||
stream: bool
|
||||
verify: None | bool | Text
|
||||
cert: None | Text | tuple[Text, Text]
|
||||
verify: None | bool | str
|
||||
cert: None | str | tuple[str, str]
|
||||
max_redirects: int
|
||||
trust_env: bool
|
||||
cookies: RequestsCookieJar
|
||||
@@ -85,29 +85,29 @@ class Session(SessionRedirectMixin):
|
||||
def request(
|
||||
self,
|
||||
method: str,
|
||||
url: str | bytes | Text,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: _Data = ...,
|
||||
headers: _TextMapping | None = ...,
|
||||
cookies: None | RequestsCookieJar | _TextMapping = ...,
|
||||
files: MutableMapping[Text, IO[Any]]
|
||||
| MutableMapping[Text, tuple[Text, IO[Any]]]
|
||||
| MutableMapping[Text, tuple[Text, IO[Any], Text]]
|
||||
| MutableMapping[Text, tuple[Text, IO[Any], Text, _TextMapping]]
|
||||
files: MutableMapping[str, IO[Any]]
|
||||
| MutableMapping[str, tuple[str, IO[Any]]]
|
||||
| MutableMapping[str, tuple[str, IO[Any], str]]
|
||||
| MutableMapping[str, tuple[str, IO[Any], str, _TextMapping]]
|
||||
| None = ...,
|
||||
auth: None | tuple[Text, Text] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] = ...,
|
||||
auth: None | tuple[str, str] | _auth.AuthBase | Callable[[PreparedRequest], PreparedRequest] = ...,
|
||||
timeout: None | float | tuple[float, float] | tuple[float, None] = ...,
|
||||
allow_redirects: bool | None = ...,
|
||||
proxies: _TextMapping | None = ...,
|
||||
hooks: _HooksInput | None = ...,
|
||||
stream: bool | None = ...,
|
||||
verify: None | bool | Text = ...,
|
||||
cert: Text | tuple[Text, Text] | None = ...,
|
||||
verify: None | bool | str = ...,
|
||||
cert: str | tuple[str, str] | None = ...,
|
||||
json: Any | None = ...,
|
||||
) -> Response: ...
|
||||
def get(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -125,7 +125,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def options(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -143,7 +143,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def head(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -161,7 +161,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def post(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
json: Any | None = ...,
|
||||
params: _Params | None = ...,
|
||||
@@ -179,7 +179,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def put(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
params: _Params | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -197,7 +197,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def patch(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
data: _Data = ...,
|
||||
params: _Params | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -215,7 +215,7 @@ class Session(SessionRedirectMixin):
|
||||
) -> Response: ...
|
||||
def delete(
|
||||
self,
|
||||
url: Text | bytes,
|
||||
url: str | bytes,
|
||||
params: _Params | None = ...,
|
||||
data: Any | None = ...,
|
||||
headers: Any | None = ...,
|
||||
@@ -237,6 +237,6 @@ class Session(SessionRedirectMixin):
|
||||
def merge_environment_settings(self, url, proxies, stream, verify, cert): ...
|
||||
def get_adapter(self, url: str) -> _BaseAdapter: ...
|
||||
def close(self) -> None: ...
|
||||
def mount(self, prefix: Text | bytes, adapter: _BaseAdapter) -> None: ...
|
||||
def mount(self, prefix: str | bytes, adapter: _BaseAdapter) -> None: ...
|
||||
|
||||
def session() -> Session: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, AnyStr, Iterable, Mapping, Text
|
||||
from typing import Any, AnyStr, Iterable, Mapping
|
||||
|
||||
from . import compat, cookies, exceptions, structures
|
||||
|
||||
@@ -41,7 +41,7 @@ def is_valid_cidr(string_network): ...
|
||||
def set_environ(env_name, value): ...
|
||||
def should_bypass_proxies(url, no_proxy: Iterable[AnyStr] | None) -> bool: ...
|
||||
def get_environ_proxies(url, no_proxy: Iterable[AnyStr] | None = ...) -> dict[Any, Any]: ...
|
||||
def select_proxy(url: Text, proxies: Mapping[Any, Any] | None): ...
|
||||
def select_proxy(url: str, proxies: Mapping[Any, Any] | None): ...
|
||||
def default_user_agent(name=...): ...
|
||||
def default_headers(): ...
|
||||
def parse_header_links(value): ...
|
||||
|
||||
Reference in New Issue
Block a user