Use TypeAlias for type aliases where possible, part II (#7667)

This commit is contained in:
Alex Waygood
2022-04-20 20:02:47 +01:00
committed by GitHub
parent c653be73b8
commit b093c90a94
41 changed files with 91 additions and 90 deletions

View File

@@ -1,5 +1,6 @@
from collections.abc import Iterator
from typing import Any
from typing_extensions import TypeAlias
class NodeVisitor:
def visit(self, node: AST) -> Any: ...
@@ -152,7 +153,7 @@ class Break(stmt): ...
class Continue(stmt): ...
class slice(AST): ...
_slice = slice # this lets us type the variable named 'slice' below
_slice: TypeAlias = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower: expr | None

View File

@@ -1,5 +1,6 @@
from collections.abc import Iterator
from typing import Any
from typing_extensions import TypeAlias
class NodeVisitor:
def visit(self, node: AST) -> Any: ...
@@ -168,7 +169,7 @@ class Break(stmt): ...
class Continue(stmt): ...
class slice(AST): ...
_slice = slice # this lets us type the variable named 'slice' below
_slice: TypeAlias = slice # this lets us type the variable named 'slice' below
class Slice(slice):
lower: expr | None