-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use is_name_token to resolve type:ignore
- Loading branch information
1 parent
e025308
commit 385c605
Showing
2 changed files
with
11 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,12 @@ | |
Set, | ||
Iterable, | ||
) | ||
if sys.version_info >= (3, 10): | ||
from typing import TypeGuard | ||
else: | ||
from typing_extensions import TypeGuard | ||
from blib2to3.pgen2.grammar import Grammar | ||
from blib2to3.pgen2 import token | ||
|
||
__author__ = "Guido van Rossum <[email protected]>" | ||
|
||
|
@@ -978,3 +983,7 @@ def generate_matches( | |
r.update(r0) | ||
r.update(r1) | ||
yield c0 + c1, r | ||
|
||
|
||
def is_name_token(nl: NL) -> TypeGuard[Leaf]: | ||
return nl.type == token.NAME |