mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
remove references to "Text" in Python 3-only stubs (#4251)
This commit is contained in:
@@ -3,7 +3,7 @@ from asyncio import events
|
||||
from asyncio import protocols
|
||||
from asyncio import streams
|
||||
from asyncio import transports
|
||||
from typing import Any, Optional, Text, Tuple, Union, IO
|
||||
from typing import Any, Optional, Tuple, Union, IO
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from os import PathLike
|
||||
@@ -22,7 +22,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
|
||||
stderr: Optional[streams.StreamReader]
|
||||
def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ...
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
def pipe_data_received(self, fd: int, data: Union[bytes, Text]) -> None: ...
|
||||
def pipe_data_received(self, fd: int, data: Union[bytes, str]) -> None: ...
|
||||
def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ...
|
||||
def process_exited(self) -> None: ...
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import codecs
|
||||
from typing import Text, Tuple
|
||||
from typing import Tuple
|
||||
|
||||
class IncrementalEncoder(codecs.IncrementalEncoder):
|
||||
def encode(self, input: Text, final: bool = ...) -> bytes: ...
|
||||
def encode(self, input: str, final: bool = ...) -> bytes: ...
|
||||
|
||||
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
|
||||
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ...
|
||||
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[str, int]: ...
|
||||
|
||||
class StreamWriter(codecs.StreamWriter): ...
|
||||
class StreamReader(codecs.StreamReader): ...
|
||||
|
||||
def getregentry() -> codecs.CodecInfo: ...
|
||||
def encode(input: Text, errors: Text = ...) -> bytes: ...
|
||||
def decode(input: bytes, errors: Text = ...) -> Text: ...
|
||||
def encode(input: str, errors: str = ...) -> bytes: ...
|
||||
def decode(input: bytes, errors: str = ...) -> str: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ from posix import listdir as listdir, times_result
|
||||
import sys
|
||||
from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, ContextManager, TypeVar
|
||||
Optional, Generic, Set, Callable, Sequence, NamedTuple, ContextManager, TypeVar
|
||||
)
|
||||
from _typeshed import AnyPath
|
||||
|
||||
@@ -365,18 +365,18 @@ if sys.platform != 'win32':
|
||||
def uname() -> uname_result: ...
|
||||
|
||||
@overload
|
||||
def getenv(key: Text) -> Optional[str]: ...
|
||||
def getenv(key: str) -> Optional[str]: ...
|
||||
@overload
|
||||
def getenv(key: Text, default: _T) -> Union[str, _T]: ...
|
||||
def getenv(key: str, default: _T) -> Union[str, _T]: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
@overload
|
||||
def getenvb(key: bytes) -> Optional[bytes]: ...
|
||||
@overload
|
||||
def getenvb(key: bytes, default: _T = ...) -> Union[bytes, _T]: ...
|
||||
def putenv(__name: Union[bytes, Text], __value: Union[bytes, Text]) -> None: ...
|
||||
def putenv(__name: Union[bytes, str], __value: Union[bytes, str]) -> None: ...
|
||||
if sys.platform != "win32":
|
||||
def unsetenv(__name: Union[bytes, Text]) -> None: ...
|
||||
def unsetenv(__name: Union[bytes, str]) -> None: ...
|
||||
|
||||
# Return IO or TextIO
|
||||
def fdopen(fd: int, mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
|
||||
@@ -595,11 +595,11 @@ if sys.version_info >= (3, 6):
|
||||
# in practice, and doing so would explode the number of combinations in this already long union.
|
||||
# All these combinations are necessary due to List being invariant.
|
||||
_ExecVArgs = Union[
|
||||
Tuple[AnyPath, ...], List[bytes], List[Text], List[PathLike[Any]], List[Union[bytes, Text]],
|
||||
List[Union[bytes, PathLike[Any]]], List[Union[Text, PathLike[Any]]], List[Union[bytes, Text, PathLike[Any]]]
|
||||
Tuple[AnyPath, ...], List[bytes], List[str], List[PathLike[Any]], List[Union[bytes, str]],
|
||||
List[Union[bytes, PathLike[Any]]], List[Union[str, PathLike[Any]]], List[Union[bytes, str, PathLike[Any]]]
|
||||
]
|
||||
else:
|
||||
_ExecVArgs = Union[Tuple[AnyPath, ...], List[bytes], List[Text], List[Union[bytes, Text]]]
|
||||
_ExecVArgs = Union[Tuple[AnyPath, ...], List[bytes], List[str], List[Union[bytes, str]]]
|
||||
|
||||
_ExecEnv = Union[Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]]]
|
||||
def execv(__path: AnyPath, __argv: _ExecVArgs) -> NoReturn: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, Type, Text, Generic, TypeVar, AnyStr, overload
|
||||
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, Type, Generic, TypeVar, AnyStr, overload
|
||||
from types import TracebackType
|
||||
from typing_extensions import Literal
|
||||
from _typeshed import AnyPath
|
||||
@@ -19,11 +19,11 @@ from _typeshed import AnyPath
|
||||
# except TimeoutError as e:
|
||||
# reveal_type(e.cmd) # Any, but morally is _CMD
|
||||
_FILE = Union[None, int, IO[Any]]
|
||||
_TXT = Union[bytes, Text]
|
||||
_TXT = Union[bytes, str]
|
||||
# Python 3.6 does't support _CMD being a single PathLike.
|
||||
# See: https://bugs.python.org/issue31961
|
||||
_CMD = Union[_TXT, Sequence[AnyPath]]
|
||||
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
|
||||
_ENV = Union[Mapping[bytes, _TXT], Mapping[str, _TXT]]
|
||||
|
||||
_S = TypeVar('_S')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from typing import Optional, Sequence, Text
|
||||
from typing import Optional, Sequence
|
||||
from types import SimpleNamespace
|
||||
|
||||
class EnvBuilder:
|
||||
@@ -39,4 +39,4 @@ elif sys.version_info >= (3, 6):
|
||||
else:
|
||||
def create(env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ...) -> None: ...
|
||||
|
||||
def main(args: Optional[Sequence[Text]] = ...) -> None: ...
|
||||
def main(args: Optional[Sequence[str]] = ...) -> None: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ import time
|
||||
import gzip
|
||||
import http.client
|
||||
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Text, Tuple, Type, Union, overload
|
||||
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Tuple, Type, Union, overload
|
||||
from typing_extensions import Literal
|
||||
from types import TracebackType
|
||||
from datetime import datetime
|
||||
@@ -93,7 +93,7 @@ WRAPPERS: Tuple[Type[DateTime], Type[Binary]] # undocumented
|
||||
class ExpatParser: # undocumented
|
||||
|
||||
def __init__(self, target: Unmarshaller) -> None: ...
|
||||
def feed(self, data: Union[Text, bytes]) -> None: ...
|
||||
def feed(self, data: Union[str, bytes]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class Marshaller:
|
||||
|
||||
Reference in New Issue
Block a user