Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,10 +1,10 @@
from _typeshed import StrPath
from typing import Dict, List, Optional, Tuple, TypeVar
from typing import Optional, TypeVar
_P = TypeVar("_P")
_Label = Tuple[int, Optional[str]]
_DFA = List[List[Tuple[int, int]]]
_DFAS = Tuple[_DFA, Dict[int, int]]
_Label = tuple[int, Optional[str]]
_DFA = list[list[tuple[int, int]]]
_DFAS = tuple[_DFA, dict[int, int]]
class Grammar:
symbol2number: dict[str, int]

View File

@@ -1,9 +1,9 @@
from lib2to3.pgen2.token import * # noqa
from typing import Callable, Iterable, Iterator, Tuple
from typing import Callable, Iterable, Iterator
_Coord = Tuple[int, int]
_Coord = tuple[int, int]
_TokenEater = Callable[[int, str, _Coord, _Coord, str], None]
_TokenInfo = Tuple[int, str, _Coord, _Coord, str]
_TokenInfo = tuple[int, str, _Coord, _Coord, str]
class TokenError(Exception): ...
class StopTokenizing(Exception): ...

View File

@@ -1,11 +1,11 @@
from lib2to3.pgen2.grammar import Grammar
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, TypeVar, Union
from typing import Any, Callable, Iterator, Optional, TypeVar, Union
_P = TypeVar("_P")
_NL = Union[Node, Leaf]
_Context = Tuple[str, int, int]
_Results = Dict[str, _NL]
_RawNode = Tuple[int, str, _Context, Optional[List[_NL]]]
_Context = tuple[str, int, int]
_Results = dict[str, _NL]
_RawNode = tuple[int, str, _Context, Optional[list[_NL]]]
_Convert = Callable[[Grammar, _RawNode], Any]
HUGE: int