Skip to content

Sync typeshed #12321

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
Apr 8, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions mypy/typeshed/stdlib/@python2/BaseHTTPServer.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import mimetools
import SocketServer
from typing import Any, BinaryIO, Callable, Mapping, Tuple
from typing import Any, BinaryIO, Callable, Mapping

class HTTPServer(SocketServer.TCPServer):
server_name: str
server_port: int
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
def __init__(self, server_address: tuple[str, int], RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...

class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
client_address: Tuple[str, int]
client_address: tuple[str, int]
server: SocketServer.BaseServer
close_connection: bool
command: str
Expand All @@ -23,8 +23,8 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
error_content_type: str
protocol_version: str
MessageClass: type
responses: Mapping[int, Tuple[str, str]]
def __init__(self, request: bytes, client_address: Tuple[str, int], server: SocketServer.BaseServer) -> None: ...
responses: Mapping[int, tuple[str, str]]
def __init__(self, request: bytes, client_address: tuple[str, int], server: SocketServer.BaseServer) -> None: ...
def handle(self) -> None: ...
def handle_one_request(self) -> None: ...
def send_error(self, code: int, message: str | None = ...) -> None: ...
Expand Down
3 changes: 1 addition & 2 deletions mypy/typeshed/stdlib/@python2/CGIHTTPServer.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import SimpleHTTPServer
from typing import List

class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
cgi_directories: List[str]
cgi_directories: list[str]
def do_POST(self) -> None: ...
30 changes: 14 additions & 16 deletions mypy/typeshed/stdlib/@python2/ConfigParser.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from _typeshed import SupportsNoArgReadline
from typing import IO, Any, Dict, List, Sequence, Tuple
from typing import IO, Any, Sequence

DEFAULTSECT: str
MAX_INTERPOLATION_DEPTH: int
Expand All @@ -9,8 +9,6 @@ class Error(Exception):
def __init__(self, msg: str = ...) -> None: ...
def _get_message(self) -> None: ...
def _set_message(self, value: str) -> None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...

class NoSectionError(Error):
section: str
Expand Down Expand Up @@ -42,7 +40,7 @@ class InterpolationDepthError(InterpolationError):

class ParsingError(Error):
filename: str
errors: List[Tuple[Any, Any]]
errors: list[tuple[Any, Any]]
def __init__(self, filename: str) -> None: ...
def append(self, lineno: Any, line: Any) -> None: ...

Expand All @@ -53,26 +51,26 @@ class MissingSectionHeaderError(ParsingError):

class RawConfigParser:
_dict: Any
_sections: Dict[Any, Any]
_defaults: Dict[Any, Any]
_sections: dict[Any, Any]
_defaults: dict[Any, Any]
_optcre: Any
SECTCRE: Any
OPTCRE: Any
OPTCRE_NV: Any
def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
def defaults(self) -> Dict[Any, Any]: ...
def sections(self) -> List[str]: ...
def __init__(self, defaults: dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
def defaults(self) -> dict[Any, Any]: ...
def sections(self) -> list[str]: ...
def add_section(self, section: str) -> None: ...
def has_section(self, section: str) -> bool: ...
def options(self, section: str) -> List[str]: ...
def read(self, filenames: str | Sequence[str]) -> List[str]: ...
def options(self, section: str) -> list[str]: ...
def read(self, filenames: str | Sequence[str]) -> list[str]: ...
def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ...
def get(self, section: str, option: str) -> str: ...
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
def items(self, section: str) -> list[tuple[Any, Any]]: ...
def _get(self, section: str, conv: type, option: str) -> Any: ...
def getint(self, section: str, option: str) -> int: ...
def getfloat(self, section: str, option: str) -> float: ...
_boolean_states: Dict[str, bool]
_boolean_states: dict[str, bool]
def getboolean(self, section: str, option: str) -> bool: ...
def optionxform(self, optionstr: str) -> str: ...
def has_option(self, section: str, option: str) -> bool: ...
Expand All @@ -84,14 +82,14 @@ class RawConfigParser:

class ConfigParser(RawConfigParser):
_KEYCRE: Any
def get(self, section: str, option: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: Dict[Any, Any] | None = ...) -> List[Tuple[str, Any]]: ...
def get(self, section: str, option: str, raw: bool = ..., vars: dict[Any, Any] | None = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: dict[Any, Any] | None = ...) -> list[tuple[str, Any]]: ...
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolation_replace(self, match: Any) -> str: ...

class SafeConfigParser(ConfigParser):
_interpvar_re: Any
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolate_some(
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int
self, option: str, accum: list[Any], rest: str, section: str, map: dict[Any, Any], depth: int
) -> None: ...
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/@python2/Cookie.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Any, Dict
from typing import Any

class CookieError(Exception): ...

class Morsel(Dict[Any, Any]):
class Morsel(dict[Any, Any]):
key: Any
def __init__(self): ...
def __setitem__(self, K, V): ...
Expand All @@ -14,7 +14,7 @@ class Morsel(Dict[Any, Any]):
def js_output(self, attrs: Any | None = ...): ...
def OutputString(self, attrs: Any | None = ...): ...

class BaseCookie(Dict[Any, Any]):
class BaseCookie(dict[Any, Any]):
def value_decode(self, val): ...
def value_encode(self, val): ...
def __init__(self, input: Any | None = ...): ...
Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/@python2/HTMLParser.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import AnyStr, List, Tuple
from typing import AnyStr

from markupbase import ParserBase

Expand All @@ -10,8 +10,8 @@ class HTMLParser(ParserBase):
def get_starttag_text(self) -> AnyStr: ...
def set_cdata_mode(self, AnyStr) -> None: ...
def clear_cdata_mode(self) -> None: ...
def handle_startendtag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_starttag(self, tag: AnyStr, attrs: List[Tuple[AnyStr, AnyStr]]): ...
def handle_startendtag(self, tag: AnyStr, attrs: list[tuple[AnyStr, AnyStr]]): ...
def handle_starttag(self, tag: AnyStr, attrs: list[tuple[AnyStr, AnyStr]]): ...
def handle_endtag(self, tag: AnyStr): ...
def handle_charref(self, name: AnyStr): ...
def handle_entityref(self, name: AnyStr): ...
Expand Down
5 changes: 3 additions & 2 deletions mypy/typeshed/stdlib/@python2/Queue.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Deque, Generic, TypeVar
from collections import deque
from typing import Any, Generic, TypeVar

_T = TypeVar("_T")

Expand All @@ -12,7 +13,7 @@ class Queue(Generic[_T]):
not_full: Any
all_tasks_done: Any
unfinished_tasks: Any
queue: Deque[Any] # undocumented
queue: deque[Any] # undocumented
def __init__(self, maxsize: int = ...) -> None: ...
def task_done(self) -> None: ...
def join(self) -> None: ...
Expand Down
27 changes: 14 additions & 13 deletions mypy/typeshed/stdlib/@python2/SocketServer.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
from socket import SocketType
from typing import Any, BinaryIO, Callable, ClassVar, List, Text, Tuple, Union
from typing import Any, BinaryIO, Callable, ClassVar, Text

class BaseServer:
address_family: int
RequestHandlerClass: Callable[..., BaseRequestHandler]
server_address: Tuple[str, int]
server_address: tuple[str, int]
socket: SocketType
allow_reuse_address: bool
request_queue_size: int
Expand All @@ -17,27 +17,27 @@ class BaseServer:
def serve_forever(self, poll_interval: float = ...) -> None: ...
def shutdown(self) -> None: ...
def server_close(self) -> None: ...
def finish_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def get_request(self) -> Tuple[SocketType, Tuple[str, int]]: ...
def handle_error(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def finish_request(self, request: bytes, client_address: tuple[str, int]) -> None: ...
def get_request(self) -> tuple[SocketType, tuple[str, int]]: ...
def handle_error(self, request: bytes, client_address: tuple[str, int]) -> None: ...
def handle_timeout(self) -> None: ...
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ...
def server_activate(self) -> None: ...
def server_bind(self) -> None: ...
def verify_request(self, request: bytes, client_address: Tuple[str, int]) -> bool: ...
def verify_request(self, request: bytes, client_address: tuple[str, int]) -> bool: ...

class TCPServer(BaseServer):
def __init__(
self,
server_address: Tuple[str, int],
server_address: tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...

class UDPServer(BaseServer):
def __init__(
self,
server_address: Tuple[str, int],
server_address: tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...
Expand All @@ -50,6 +50,7 @@ if sys.platform != "win32":
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...,
) -> None: ...

class UnixDatagramServer(BaseServer):
def __init__(
self,
Expand All @@ -61,16 +62,16 @@ if sys.platform != "win32":
if sys.platform != "win32":
class ForkingMixIn:
timeout: float | None # undocumented
active_children: List[int] | None # undocumented
active_children: list[int] | None # undocumented
max_children: int # undocumented
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ...

class ThreadingMixIn:
daemon_threads: bool
def process_request_thread(self, request: bytes, client_address: Tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: Tuple[str, int]) -> None: ...
def process_request_thread(self, request: bytes, client_address: tuple[str, int]) -> None: ... # undocumented
def process_request(self, request: bytes, client_address: tuple[str, int]) -> None: ...

if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/@python2/StringIO.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator, List
from typing import IO, Any, AnyStr, Generic, Iterable, Iterator

class StringIO(IO[AnyStr], Generic[AnyStr]):
closed: bool
Expand All @@ -14,7 +14,7 @@ class StringIO(IO[AnyStr], Generic[AnyStr]):
def tell(self) -> int: ...
def read(self, n: int = ...) -> AnyStr: ...
def readline(self, length: int = ...) -> AnyStr: ...
def readlines(self, sizehint: int = ...) -> List[AnyStr]: ...
def readlines(self, sizehint: int = ...) -> list[AnyStr]: ...
def truncate(self, size: int | None = ...) -> int: ...
def write(self, s: AnyStr) -> int: ...
def writelines(self, iterable: Iterable[AnyStr]) -> None: ...
Expand Down
16 changes: 8 additions & 8 deletions mypy/typeshed/stdlib/@python2/UserDict.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import Any, Container, Dict, Generic, Iterable, Iterator, List, Mapping, Sized, Tuple, TypeVar, overload
from typing import Any, Container, Generic, Iterable, Iterator, Mapping, Sized, TypeVar, overload

_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")

class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
class UserDict(dict[_KT, _VT], Generic[_KT, _VT]):
data: dict[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
# TODO: __iter__ is not available for UserDict

Expand All @@ -21,18 +21,18 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def get(self, k: _KT) -> _VT | None: ...
@overload
def get(self, k: _KT, default: _VT | _T) -> _VT | _T: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def values(self) -> list[_VT]: ...
def items(self) -> list[tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ...
def __contains__(self, o: Any) -> bool: ...
# From typing.MutableMapping[_KT, _VT]
def clear(self) -> None: ...
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def popitem(self) -> tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
@overload
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def update(self, m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
8 changes: 4 additions & 4 deletions mypy/typeshed/stdlib/@python2/UserList.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Iterable, List, MutableSequence, TypeVar, overload
from _typeshed import Self
from typing import Iterable, MutableSequence, TypeVar, overload

_T = TypeVar("_T")
_S = TypeVar("_S")

class UserList(MutableSequence[_T]):
data: List[_T]
data: list[_T]
def insert(self, index: int, object: _T) -> None: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
Expand All @@ -15,5 +15,5 @@ class UserList(MutableSequence[_T]):
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
def __getitem__(self: _S, s: slice) -> _S: ...
def __getitem__(self: Self, s: slice) -> Self: ...
def sort(self) -> None: ...
Loading