Skip to content

Commit e1d89e5

Browse files
remove references to "Text" in Python 3-only stubs (#4251)
1 parent 66a9a4b commit e1d89e5

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

stdlib/3/asyncio/subprocess.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from asyncio import events
33
from asyncio import protocols
44
from asyncio import streams
55
from asyncio import transports
6-
from typing import Any, Optional, Text, Tuple, Union, IO
6+
from typing import Any, Optional, Tuple, Union, IO
77

88
if sys.version_info >= (3, 8):
99
from os import PathLike
@@ -22,7 +22,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
2222
stderr: Optional[streams.StreamReader]
2323
def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ...
2424
def connection_made(self, transport: transports.BaseTransport) -> None: ...
25-
def pipe_data_received(self, fd: int, data: Union[bytes, Text]) -> None: ...
25+
def pipe_data_received(self, fd: int, data: Union[bytes, str]) -> None: ...
2626
def pipe_connection_lost(self, fd: int, exc: Optional[Exception]) -> None: ...
2727
def process_exited(self) -> None: ...
2828

stdlib/3/encodings/utf_8.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import codecs
2-
from typing import Text, Tuple
2+
from typing import Tuple
33

44
class IncrementalEncoder(codecs.IncrementalEncoder):
5-
def encode(self, input: Text, final: bool = ...) -> bytes: ...
5+
def encode(self, input: str, final: bool = ...) -> bytes: ...
66

77
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
8-
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[Text, int]: ...
8+
def _buffer_decode(self, input: bytes, errors: str, final: bool) -> Tuple[str, int]: ...
99

1010
class StreamWriter(codecs.StreamWriter): ...
1111
class StreamReader(codecs.StreamReader): ...
1212

1313
def getregentry() -> codecs.CodecInfo: ...
14-
def encode(input: Text, errors: Text = ...) -> bytes: ...
15-
def decode(input: bytes, errors: Text = ...) -> Text: ...
14+
def encode(input: str, errors: str = ...) -> bytes: ...
15+
def decode(input: bytes, errors: str = ...) -> str: ...

stdlib/3/os/__init__.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from posix import listdir as listdir, times_result
33
import sys
44
from typing import (
55
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
6-
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, ContextManager, TypeVar
6+
Optional, Generic, Set, Callable, Sequence, NamedTuple, ContextManager, TypeVar
77
)
88
from _typeshed import AnyPath
99

@@ -365,18 +365,18 @@ if sys.platform != 'win32':
365365
def uname() -> uname_result: ...
366366

367367
@overload
368-
def getenv(key: Text) -> Optional[str]: ...
368+
def getenv(key: str) -> Optional[str]: ...
369369
@overload
370-
def getenv(key: Text, default: _T) -> Union[str, _T]: ...
370+
def getenv(key: str, default: _T) -> Union[str, _T]: ...
371371

372372
if sys.platform != "win32":
373373
@overload
374374
def getenvb(key: bytes) -> Optional[bytes]: ...
375375
@overload
376376
def getenvb(key: bytes, default: _T = ...) -> Union[bytes, _T]: ...
377-
def putenv(__name: Union[bytes, Text], __value: Union[bytes, Text]) -> None: ...
377+
def putenv(__name: Union[bytes, str], __value: Union[bytes, str]) -> None: ...
378378
if sys.platform != "win32":
379-
def unsetenv(__name: Union[bytes, Text]) -> None: ...
379+
def unsetenv(__name: Union[bytes, str]) -> None: ...
380380

381381
# Return IO or TextIO
382382
def fdopen(fd: int, mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
@@ -595,11 +595,11 @@ if sys.version_info >= (3, 6):
595595
# in practice, and doing so would explode the number of combinations in this already long union.
596596
# All these combinations are necessary due to List being invariant.
597597
_ExecVArgs = Union[
598-
Tuple[AnyPath, ...], List[bytes], List[Text], List[PathLike[Any]], List[Union[bytes, Text]],
599-
List[Union[bytes, PathLike[Any]]], List[Union[Text, PathLike[Any]]], List[Union[bytes, Text, PathLike[Any]]]
598+
Tuple[AnyPath, ...], List[bytes], List[str], List[PathLike[Any]], List[Union[bytes, str]],
599+
List[Union[bytes, PathLike[Any]]], List[Union[str, PathLike[Any]]], List[Union[bytes, str, PathLike[Any]]]
600600
]
601601
else:
602-
_ExecVArgs = Union[Tuple[AnyPath, ...], List[bytes], List[Text], List[Union[bytes, Text]]]
602+
_ExecVArgs = Union[Tuple[AnyPath, ...], List[bytes], List[str], List[Union[bytes, str]]]
603603

604604
_ExecEnv = Union[Mapping[bytes, Union[bytes, str]], Mapping[str, Union[bytes, str]]]
605605
def execv(__path: AnyPath, __argv: _ExecVArgs) -> NoReturn: ...

stdlib/3/subprocess.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, Type, Text, Generic, TypeVar, AnyStr, overload
2+
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, Type, Generic, TypeVar, AnyStr, overload
33
from types import TracebackType
44
from typing_extensions import Literal
55
from _typeshed import AnyPath
@@ -19,11 +19,11 @@ from _typeshed import AnyPath
1919
# except TimeoutError as e:
2020
# reveal_type(e.cmd) # Any, but morally is _CMD
2121
_FILE = Union[None, int, IO[Any]]
22-
_TXT = Union[bytes, Text]
22+
_TXT = Union[bytes, str]
2323
# Python 3.6 does't support _CMD being a single PathLike.
2424
# See: https://bugs.python.org/issue31961
2525
_CMD = Union[_TXT, Sequence[AnyPath]]
26-
_ENV = Union[Mapping[bytes, _TXT], Mapping[Text, _TXT]]
26+
_ENV = Union[Mapping[bytes, _TXT], Mapping[str, _TXT]]
2727

2828
_S = TypeVar('_S')
2929
_T = TypeVar('_T')

stdlib/3/venv/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import AnyPath
3-
from typing import Optional, Sequence, Text
3+
from typing import Optional, Sequence
44
from types import SimpleNamespace
55

66
class EnvBuilder:
@@ -39,4 +39,4 @@ elif sys.version_info >= (3, 6):
3939
else:
4040
def create(env_dir: AnyPath, system_site_packages: bool = ..., clear: bool = ..., symlinks: bool = ..., with_pip: bool = ...) -> None: ...
4141

42-
def main(args: Optional[Sequence[Text]] = ...) -> None: ...
42+
def main(args: Optional[Sequence[str]] = ...) -> None: ...

stdlib/3/xmlrpc/client.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import time
44
import gzip
55
import http.client
66

7-
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Text, Tuple, Type, Union, overload
7+
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol, Tuple, Type, Union, overload
88
from typing_extensions import Literal
99
from types import TracebackType
1010
from datetime import datetime
@@ -93,7 +93,7 @@ WRAPPERS: Tuple[Type[DateTime], Type[Binary]] # undocumented
9393
class ExpatParser: # undocumented
9494

9595
def __init__(self, target: Unmarshaller) -> None: ...
96-
def feed(self, data: Union[Text, bytes]) -> None: ...
96+
def feed(self, data: Union[str, bytes]) -> None: ...
9797
def close(self) -> None: ...
9898

9999
class Marshaller:

0 commit comments

Comments
 (0)