Update pyright (#6840)

This commit is contained in:
Sebastian Rittau
2022-01-07 17:58:15 +01:00
committed by GitHub
parent da78d7cbc3
commit e77a66aced
21 changed files with 37 additions and 31 deletions

View File

@@ -88,7 +88,7 @@ def open(
newline: str | None = ...,
) -> BZ2File | TextIO: ...
class BZ2File(BaseStream, IO[bytes]):
class BZ2File(BaseStream, IO[bytes]): # type: ignore # argument disparities between base classes
def __enter__(self: Self) -> Self: ...
if sys.version_info >= (3, 9):
@overload

View File

@@ -1,10 +1,12 @@
import email.feedparser
from email.message import Message
from email.policy import Policy
from typing import BinaryIO, Callable, TextIO
from typing import BinaryIO, Callable, TextIO, TypeVar
FeedParser = email.feedparser.FeedParser
BytesFeedParser = email.feedparser.BytesFeedParser
_M = TypeVar("_M", bound=Message)
FeedParser = email.feedparser.FeedParser[_M]
BytesFeedParser = email.feedparser.BytesFeedParser[_M]
class Parser:
def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ...

View File

@@ -78,7 +78,7 @@ class HTTPMessage(email.message.Message):
def parse_headers(fp: io.BufferedIOBase, _class: Callable[[], email.message.Message] = ...) -> HTTPMessage: ...
class HTTPResponse(io.BufferedIOBase, BinaryIO):
class HTTPResponse(io.BufferedIOBase, BinaryIO): # type: ignore # argument disparities between base classes
msg: HTTPMessage
headers: HTTPMessage
version: int

View File

@@ -129,10 +129,10 @@ class FileFinder(importlib.abc.PathEntryFinder):
cls, *loader_details: tuple[importlib.abc.Loader, list[str]]
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader):
class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): # type: ignore # argument disparities
def set_data(self, path: importlib.abc._Path, data: bytes, *, _mode: int = ...) -> None: ...
class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ...
class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ... # type: ignore # argument disparities
class ExtensionFileLoader(importlib.abc.ExecutionLoader):
def __init__(self, name: str, path: importlib.abc._Path) -> None: ...

View File

@@ -63,7 +63,7 @@ class BufferedIOBase(IOBase):
def read(self, __size: int | None = ...) -> bytes: ...
def read1(self, __size: int = ...) -> bytes: ...
class FileIO(RawIOBase, BinaryIO):
class FileIO(RawIOBase, BinaryIO): # type: ignore # argument disparities between the base classes
mode: str
name: StrOrBytesPath | int # type: ignore[assignment]
def __init__(
@@ -75,7 +75,7 @@ class FileIO(RawIOBase, BinaryIO):
def read(self, __size: int = ...) -> bytes: ...
def __enter__(self: Self) -> Self: ...
class BytesIO(BufferedIOBase, BinaryIO):
class BytesIO(BufferedIOBase, BinaryIO): # type: ignore # argument disparities between the base classes
def __init__(self, initial_bytes: bytes = ...) -> None: ...
# BytesIO does not contain a "name" field. This workaround is necessary
# to allow BytesIO sub-classes to add this field, as it is defined
@@ -89,7 +89,7 @@ class BytesIO(BufferedIOBase, BinaryIO):
else:
def read1(self, __size: int | None) -> bytes: ... # type: ignore[override]
class BufferedReader(BufferedIOBase, BinaryIO):
class BufferedReader(BufferedIOBase, BinaryIO): # type: ignore # argument disparities between base classes
def __enter__(self: Self) -> Self: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def peek(self, __size: int = ...) -> bytes: ...
@@ -98,7 +98,7 @@ class BufferedReader(BufferedIOBase, BinaryIO):
else:
def read1(self, __size: int) -> bytes: ... # type: ignore[override]
class BufferedWriter(BufferedIOBase, BinaryIO):
class BufferedWriter(BufferedIOBase, BinaryIO): # type: ignore # argument disparities between base classes
def __enter__(self: Self) -> Self: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def write(self, __buffer: ReadableBuffer) -> int: ...
@@ -130,7 +130,7 @@ class TextIOBase(IOBase):
def read(self, __size: int | None = ...) -> str: ...
def tell(self) -> int: ...
class TextIOWrapper(TextIOBase, TextIO):
class TextIOWrapper(TextIOBase, TextIO): # type: ignore # argument disparities between base classes
def __init__(
self,
buffer: IO[bytes],

View File

@@ -64,7 +64,7 @@ class LZMACompressor:
class LZMAError(Exception): ...
class LZMAFile(io.BufferedIOBase, IO[bytes]):
class LZMAFile(io.BufferedIOBase, IO[bytes]): # type: ignore # argument disparities between base classes
def __init__(
self,
filename: _PathOrFile | None = ...,

View File

@@ -406,7 +406,7 @@ if sys.version_info >= (3, 8):
await_args_list: _CallList
class AsyncMagicMixin(MagicMixin):
def __init__(self, *args: Any, **kw: Any) -> None: ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ...
class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): ... # type: ignore # argument disparities between base classes
class MagicProxy:
name: Any