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

@@ -72,7 +72,7 @@ jobs:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
fail-fast: false
env:
PYRIGHT_VERSION: 1.1.192 # Must match pyright_test.py.
PYRIGHT_VERSION: 1.1.204 # Must match pyright_test.py.
steps:
- uses: actions/checkout@v2
- uses: jakebailey/pyright-action@v1

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

View File

@@ -10,7 +10,7 @@ class _SybNumeric_pyodbc(sqltypes.Numeric):
class SybaseExecutionContext_pyodbc(SybaseExecutionContext):
def set_ddl_autocommit(self, connection, value) -> None: ...
class SybaseDialect_pyodbc(PyODBCConnector, SybaseDialect):
class SybaseDialect_pyodbc(PyODBCConnector, SybaseDialect): # type: ignore # argument disparities between base classes
supports_statement_cache: bool
colspecs: Any
@classmethod

View File

@@ -75,7 +75,7 @@ class ORMFromStatementCompileState(ORMCompileState):
@classmethod
def create_for_statement(cls, statement_container, compiler, **kw): ...
class ORMSelectCompileState(ORMCompileState, SelectState):
class ORMSelectCompileState(ORMCompileState, SelectState): # type: ignore # argument disparities between base classes
multi_row_eager_loaders: bool
compound_eager_adapter: Any
correlate: Any

View File

@@ -37,7 +37,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause):
def tometadata(self, metadata, schema=..., referred_schema_fn: Any | None = ..., name: Any | None = ...): ...
def to_metadata(self, metadata, schema=..., referred_schema_fn: Any | None = ..., name: Any | None = ...): ...
class Column(DialectKWArgs, SchemaItem, ColumnClause):
class Column(DialectKWArgs, SchemaItem, ColumnClause): # type: ignore # argument disparities between base classes
__visit_name__: str
inherit_cache: bool
key: Any

View File

@@ -155,7 +155,7 @@ class SchemaType(SchemaEventTarget):
def create(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ...
def drop(self, bind: Any | None = ..., checkfirst: bool = ...) -> None: ...
class Enum(Emulated, String, SchemaType):
class Enum(Emulated, String, SchemaType): # type: ignore # argument disparities between base classes
__visit_name__: str
def __init__(self, *enums, **kw) -> None: ...
@property

View File

@@ -79,7 +79,7 @@ class NullTranslations(gettext.NullTranslations):
ugettext: Any
ungettext: Any
class Translations(NullTranslations, gettext.GNUTranslations):
class Translations(NullTranslations, gettext.GNUTranslations): # type: ignore # argument disparities between base classes
DEFAULT_DOMAIN: str
domain: Any
def __init__(self, fp: Any | None = ..., domain: Any | None = ...) -> None: ...

View File

@@ -37,7 +37,7 @@ class LXMLTreeBuilderForXML(TreeBuilder):
def comment(self, content) -> None: ...
def test_fragment_to_document(self, fragment): ...
class LXMLTreeBuilder(HTMLTreeBuilder, LXMLTreeBuilderForXML):
class LXMLTreeBuilder(HTMLTreeBuilder, LXMLTreeBuilderForXML): # type: ignore # argument disparities between base classes
NAME: Any
ALTERNATE_NAMES: Any
features: Any

View File

@@ -64,7 +64,7 @@ class HmacAuthV4Handler(AuthHandler, HmacKeys):
def signature(self, http_request, string_to_sign): ...
def add_auth(self, req, **kwargs): ...
class S3HmacAuthV4Handler(HmacAuthV4Handler, AuthHandler):
class S3HmacAuthV4Handler(HmacAuthV4Handler, AuthHandler): # type: ignore # argument disparities between base classes
capability: Any
region_name: Any
def __init__(self, *args, **kwargs) -> None: ...

View File

@@ -268,7 +268,7 @@ class AsyncMockMixin(Base):
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(Base):
name: str

View File

@@ -6,7 +6,6 @@ _T = TypeVar("_T")
@final
class Pattern(Generic[AnyStr]):
pattern: AnyStr
flags: int
groups: int

View File

@@ -149,6 +149,6 @@ def cache_all(value: None) -> bool: ...
def escape(pattern: AnyStr, special_only: bool = ..., literal_spaces: bool = ...) -> AnyStr: ...
def template(pattern: AnyStr | _regex.Pattern[AnyStr], flags: int = ...) -> _regex.Pattern[AnyStr]: ...
Pattern = _regex.Pattern
Match = _regex.Match
Pattern = _regex.Pattern[AnyStr]
Match = _regex.Match[AnyStr]
Regex = compile

View File

@@ -1,13 +1,15 @@
import datetime
from json import JSONDecoder
from typing import Any, Callable, Iterator, Text, Type
from typing import Any, Callable, Iterator, Text, Type, TypeVar
from . import auth, cookies, exceptions, hooks, status_codes, structures, utils
from .cookies import RequestsCookieJar
from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util
_VT = TypeVar("_VT")
default_hooks = hooks.default_hooks
CaseInsensitiveDict = structures.CaseInsensitiveDict
CaseInsensitiveDict = structures.CaseInsensitiveDict[_VT]
HTTPBasicAuth = auth.HTTPBasicAuth
cookiejar_from_dict = cookies.cookiejar_from_dict
get_cookie_header = cookies.get_cookie_header

View File

@@ -5,6 +5,9 @@ from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, model
from .models import Response
from .packages.urllib3 import _collections
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_BaseAdapter = adapters.BaseAdapter
OrderedDict = compat.OrderedDict
cookiejar_from_dict = cookies.cookiejar_from_dict
@@ -23,8 +26,8 @@ TooManyRedirects = exceptions.TooManyRedirects
InvalidSchema = exceptions.InvalidSchema
ChunkedEncodingError = exceptions.ChunkedEncodingError
ContentDecodingError = exceptions.ContentDecodingError
RecentlyUsedContainer = _collections.RecentlyUsedContainer
CaseInsensitiveDict = structures.CaseInsensitiveDict
RecentlyUsedContainer = _collections.RecentlyUsedContainer[_KT, _VT]
CaseInsensitiveDict = structures.CaseInsensitiveDict[_VT]
HTTPAdapter = adapters.HTTPAdapter
requote_uri = utils.requote_uri
get_environ_proxies = utils.get_environ_proxies

View File

@@ -5,7 +5,7 @@ import subprocess
import sys
from pathlib import Path
_PYRIGHT_VERSION = "1.1.192" # Must match tests.yml.
_PYRIGHT_VERSION = "1.1.204" # Must match .github/workflows/tests.yml.
_WELL_KNOWN_FILE = Path("tests", "pyright_test.py")