Use PEP 585 syntax in @python2/_ast, convert more TypeVars to _typeshed.Self, & # noqa a SQLAlchemy line (#6954)

* Manual fixes for `_ast` and `SQLAlchemy`

* Change more `TypeVar`s to `Self`, using script
This commit is contained in:
Alex Waygood
2022-01-18 19:15:34 +00:00
committed by GitHub
parent 989fe11806
commit cd93461225
9 changed files with 105 additions and 102 deletions

View File

@@ -1,4 +1,5 @@
import sys
from _typeshed import Self
from array import array
from typing import (
Any,
@@ -74,15 +75,15 @@ class _CData(metaclass=_CDataMeta):
_b_needsfree_: bool = ...
_objects: Mapping[Any, int] | None = ...
@classmethod
def from_buffer(cls: type[_CT], source: _WritableBuffer, offset: int = ...) -> _CT: ...
def from_buffer(cls: type[Self], source: _WritableBuffer, offset: int = ...) -> Self: ...
@classmethod
def from_buffer_copy(cls: type[_CT], source: _ReadOnlyBuffer, offset: int = ...) -> _CT: ...
def from_buffer_copy(cls: type[Self], source: _ReadOnlyBuffer, offset: int = ...) -> Self: ...
@classmethod
def from_address(cls: type[_CT], address: int) -> _CT: ...
def from_address(cls: type[Self], address: int) -> Self: ...
@classmethod
def from_param(cls: type[_CT], obj: Any) -> _UnionT[_CT, _CArgObject]: ...
@classmethod
def in_dll(cls: type[_CT], library: CDLL, name: str) -> _CT: ...
def in_dll(cls: type[Self], library: CDLL, name: str) -> Self: ...
class _CanCastTo(_CData): ...
class _PointerLike(_CanCastTo): ...