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,10 +1,10 @@
from _typeshed import Self
from types import TracebackType
from typing import Any, Container, NamedTuple, Sequence, Text, TypeVar, Union
from typing import Any, Container, NamedTuple, Sequence, Text, Union
_Decimal = Union[Decimal, int]
_DecimalNew = Union[Decimal, float, Text, tuple[int, Sequence[int], int]]
_ComparableNum = Union[Decimal, float]
_DecimalT = TypeVar("_DecimalT", bound=Decimal)
class DecimalTuple(NamedTuple):
sign: int
@@ -41,7 +41,7 @@ def getcontext() -> Context: ...
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
class Decimal(object):
def __new__(cls: type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
def __new__(cls: type[Self], value: _DecimalNew = ..., context: Context | None = ...) -> Self: ...
@classmethod
def from_float(cls, __f: float) -> Decimal: ...
def __nonzero__(self) -> bool: ...