Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,7 +1,6 @@
from _typeshed import StrPath
from typing import Dict, List, Optional, Text, Tuple, TypeVar
from _typeshed import Self, StrPath
from typing import Dict, List, Optional, Text, Tuple
_P = TypeVar("_P")
_Label = Tuple[int, Optional[Text]]
_DFA = List[List[Tuple[int, int]]]
_DFAS = Tuple[_DFA, Dict[int, int]]
@@ -19,7 +18,7 @@ class Grammar:
def __init__(self) -> None: ...
def dump(self, filename: StrPath) -> None: ...
def load(self, filename: StrPath) -> None: ...
def copy(self: _P) -> _P: ...
def copy(self: Self) -> Self: ...
def report(self) -> None: ...
opmap_raw: Text

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from lib2to3.pgen2.grammar import Grammar
from typing import Any, Callable, Dict, Iterator, List, Optional, Text, Tuple, TypeVar, Union
@@ -21,7 +22,7 @@ class Base:
was_checked: bool
def __eq__(self, other: Any) -> bool: ...
def _eq(self: _P, other: _P) -> bool: ...
def clone(self: _P) -> _P: ...
def clone(self: Self) -> Self: ...
def post_order(self) -> Iterator[_NL]: ...
def pre_order(self) -> Iterator[_NL]: ...
def replace(self, new: _NL | List[_NL]) -> None: ...