Bump pyright to v1.1.360 (#11810)

This commit is contained in:
Alex Waygood
2024-04-24 13:09:16 +01:00
committed by GitHub
parent 29db988c0a
commit d0f2be92ab
20 changed files with 100 additions and 46 deletions

View File

@@ -124,7 +124,8 @@ class Connection(Generic[_C]):
) -> None: ...
@overload
def __init__(
self: Connection[_C], # different between overloads
# different between overloads:
self: Connection[_C], # pyright: ignore[reportInvalidTypeVarUse] #11780
*,
host: str | None = None,
user: Incomplete | None = None,

View File

@@ -12,7 +12,7 @@ class FormField(Field, Generic[_BoundFormT]):
form: _BoundFormT
separator: str
def __init__(
self: FormField[_BoundFormT],
self: FormField[_BoundFormT], # pyright: ignore[reportInvalidTypeVarUse] #11780
form_class: type[_BoundFormT],
label: str | None = None,
validators: None = None,

View File

@@ -15,7 +15,7 @@ class FieldList(Field, Generic[_BoundFieldT]):
entries: list[_BoundFieldT]
object_data: Iterable[Any]
def __init__(
self: FieldList[_BoundFieldT],
self: FieldList[_BoundFieldT], # pyright: ignore[reportInvalidTypeVarUse] #11780
# because of our workaround we need to accept Field as well
unbound_field: UnboundField[_BoundFieldT] | _BoundFieldT,
label: str | None = None,

View File

@@ -45,7 +45,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, []],
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _RequestHandler[_RequestT_contra, []] | None,
RequestClass: type[_RequestT_contra],
args: tuple[()] = (),
@@ -54,7 +54,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, []],
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _RequestHandler[_RequestT_contra, []] | None = None,
*,
RequestClass: type[_RequestT_contra],
@@ -74,7 +74,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, [_AppT_contra]],
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None,
RequestClass: type[_RequestT_contra],
args: tuple[()] = (),
@@ -84,7 +84,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
) -> None: ...
@overload
def __init__(
self: wsgify[_RequestT_contra, [_AppT_contra]],
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None = None,
*,
RequestClass: type[_RequestT_contra],

View File

@@ -80,7 +80,9 @@ class OpenDescriptor(Generic[_IOT]):
def buffer_size_for_stream(cls, stream: object) -> int: ...
class FileObjectBase(Generic[_IOT, AnyStr]):
def __init__(self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT]) -> None: ...
def __init__(
self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT] # pyright: ignore[reportInvalidTypeVarUse] #11780
) -> None: ...
io: _IOT
@property
def closed(self) -> bool: ...

View File

@@ -31,7 +31,9 @@ class Lazy(Generic[_T]):
class readproperty(Generic[_T]):
func: Callable[[Any], _T]
def __init__(self: readproperty[_T], func: Callable[[Any], _T]) -> None: ...
def __init__(
self: readproperty[_T], func: Callable[[Any], _T] # pyright: ignore[reportInvalidTypeVarUse] #11780
) -> None: ...
@overload
def __get__(self, inst: None, class_: type[object]) -> Self: ...
@overload

View File

@@ -19,7 +19,12 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]):
kwargs: dict[str, Any]
value: _T | None
@overload
def __init__(self: Greenlet[_P, _T], run: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
def __init__(
self: Greenlet[_P, _T], # pyright: ignore[reportInvalidTypeVarUse] #11780
run: Callable[_P, _T],
*args: _P.args,
**kwargs: _P.kwargs,
) -> None: ...
@overload
def __init__(self: Greenlet[[], None]) -> None: ...
@readproperty

View File

@@ -160,15 +160,25 @@ class SassMap(Mapping[_KT, _VT_co]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ...
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT_co], /) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], map: SupportsKeysAndGetItem[str, _VT_co], /, **kwargs: _VT_co) -> None: ...
def __init__(
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
map: SupportsKeysAndGetItem[str, _VT_co],
/,
**kwargs: _VT_co,
) -> None: ...
@overload
def __init__(self, iterable: Iterable[tuple[_KT, _VT_co]], /) -> None: ...
@overload
def __init__(self: SassMap[str, _VT_co], iterable: Iterable[tuple[str, _VT_co]], /, **kwargs: _VT_co) -> None: ...
def __init__(
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
iterable: Iterable[tuple[str, _VT_co]],
/,
**kwargs: _VT_co,
) -> None: ...
def __getitem__(self, key: _KT) -> _VT_co: ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...

View File

@@ -177,7 +177,7 @@ class _patch(Generic[_T]):
kwargs: Mapping[str, Any]
additional_patchers: Any
def __init__(
self: _patch[_T],
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
getter: Callable[[], Any],
attribute: str,
new: _T,

View File

@@ -36,7 +36,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
@overload
def __init__(
self: Typed[_T, Literal[True]],
self: Typed[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -45,7 +45,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
) -> None: ...
@overload
def __init__(
self: Typed[_T, Literal[False]],
self: Typed[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -64,7 +64,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
class Convertible(Typed[_T, _N]):
@overload
def __init__(
self: Convertible[_T, Literal[True]],
self: Convertible[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -72,7 +72,7 @@ class Convertible(Typed[_T, _N]):
) -> None: ...
@overload
def __init__(
self: Convertible[_T, Literal[False]],
self: Convertible[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],

View File

@@ -25,7 +25,7 @@ class Nested(Descriptor[_T]):
namespace: str | None
# In usage, "Nested" is closed to "Typed" than "Descriptor", but doesn't use allow_none
def __init__(
self: Nested[_T],
self: Nested[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -44,7 +44,7 @@ class Nested(Descriptor[_T]):
class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
@overload
def __init__(
self: NestedValue[_T, Literal[True]],
self: NestedValue[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -52,7 +52,7 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
) -> None: ...
@overload
def __init__(
self: NestedValue[_T, Literal[False]],
self: NestedValue[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -115,7 +115,7 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
class NestedText(NestedValue[_T, _N]):
@overload
def __init__(
self: NestedText[_T, Literal[True]],
self: NestedText[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],
@@ -123,7 +123,7 @@ class NestedText(NestedValue[_T, _N]):
) -> None: ...
@overload
def __init__(
self: NestedText[_T, Literal[False]],
self: NestedText[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
name: str | None = None,
*,
expected_type: _ExpectedTypeParam[_T],

View File

@@ -308,7 +308,7 @@ class ConnectionPool(Generic[_ConnectionT]):
@overload
def __init__(
self: ConnectionPool[_ConnectionT],
self: ConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
connection_class: type[_ConnectionT],
max_connections: int | None = None,
# **kwargs are passed to the constructed connection instances.
@@ -332,7 +332,7 @@ class BlockingConnectionPool(ConnectionPool[_ConnectionT]):
@overload
def __init__(
self: BlockingConnectionPool[_ConnectionT],
self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
max_connections: int,
timeout: int | None,
connection_class: type[_ConnectionT],
@@ -342,7 +342,7 @@ class BlockingConnectionPool(ConnectionPool[_ConnectionT]):
) -> None: ...
@overload
def __init__(
self: BlockingConnectionPool[_ConnectionT],
self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780
max_connections: int = 50,
timeout: int | None = 20,
*,

View File

@@ -26,7 +26,7 @@ class postfork(Generic[_P, _T]):
@overload
def __init__(self: postfork[..., Any], f: int) -> None: ...
@overload
def __init__(self: postfork[_P, _T], f: Callable[_P, _T]) -> None: ...
def __init__(self: postfork[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
@overload
def __call__(self, f: Callable[_P2, _T2], /) -> postfork[_P2, _T2]: ...
@overload
@@ -70,7 +70,7 @@ class mulefunc(Generic[_P, _T]):
@overload
def __init__(self: mulefunc[..., Any], f: int) -> None: ...
@overload
def __init__(self: mulefunc[_P, _T], f: Callable[_P, _T]) -> None: ...
def __init__(self: mulefunc[_P, _T], f: Callable[_P, _T]) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
def real_call(self, *args: _P.args, **kwargs: _P.kwargs) -> None: ...
@overload
def __call__(self, f: Callable[_P2, _T2], /) -> mulefunc[_P2, _T2]: ...