Use TypeAlias where possible for type aliases (#7630)

This commit is contained in:
Alex Waygood
2022-04-16 02:01:00 +01:00
committed by GitHub
parent c0e6dd3f3f
commit 740193a8fc
218 changed files with 760 additions and 625 deletions

View File

@@ -1,7 +1,7 @@
import sys
from _tracemalloc import *
from typing import Any, Sequence, Union, overload
from typing_extensions import SupportsIndex
from typing_extensions import SupportsIndex, TypeAlias
def get_object_traceback(obj: object) -> Traceback | None: ...
def take_snapshot() -> Snapshot: ...
@@ -41,7 +41,7 @@ class StatisticDiff:
def __init__(self, traceback: Traceback, size: int, size_diff: int, count: int, count_diff: int) -> None: ...
def __eq__(self, other: object) -> bool: ...
_FrameTupleT = tuple[str, int]
_FrameTupleT: TypeAlias = tuple[str, int]
class Frame:
@property
@@ -61,9 +61,9 @@ class Frame:
def __le__(self, other: Frame, NotImplemented: Any = ...) -> bool: ...
if sys.version_info >= (3, 9):
_TraceTupleT = Union[tuple[int, int, Sequence[_FrameTupleT], int | None], tuple[int, int, Sequence[_FrameTupleT]]]
_TraceTupleT: TypeAlias = Union[tuple[int, int, Sequence[_FrameTupleT], int | None], tuple[int, int, Sequence[_FrameTupleT]]]
else:
_TraceTupleT = tuple[int, int, Sequence[_FrameTupleT]]
_TraceTupleT: TypeAlias = tuple[int, int, Sequence[_FrameTupleT]]
class Trace:
@property