mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-26 06:01:15 +08:00
Remove the token stub in favor of inline annotations
This commit is contained in:
@@ -4,7 +4,10 @@ from enum import Enum
|
||||
|
||||
|
||||
class TokenType(object):
|
||||
def __init__(self, name, contains_syntax=False):
|
||||
name: str
|
||||
contains_syntax: bool
|
||||
|
||||
def __init__(self, name: str, contains_syntax: bool = False):
|
||||
self.name = name
|
||||
self.contains_syntax = contains_syntax
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
from typing import Container, Iterable
|
||||
|
||||
class TokenType:
|
||||
name: str
|
||||
contains_syntax: bool
|
||||
def __init__(self, name: str, contains_syntax: bool) -> None: ...
|
||||
|
||||
class TokenTypes:
|
||||
def __init__(
|
||||
self, names: Iterable[str], contains_syntax: Container[str]
|
||||
) -> None: ...
|
||||
|
||||
# not an actual class in the source code, but we need this class to type the fields of
|
||||
# PythonTokenTypes
|
||||
class _FakePythonTokenTypesClass(TokenTypes):
|
||||
STRING: TokenType
|
||||
NUMBER: TokenType
|
||||
NAME: TokenType
|
||||
ERRORTOKEN: TokenType
|
||||
NEWLINE: TokenType
|
||||
INDENT: TokenType
|
||||
DEDENT: TokenType
|
||||
ERROR_DEDENT: TokenType
|
||||
FSTRING_STRING: TokenType
|
||||
FSTRING_START: TokenType
|
||||
FSTRING_END: TokenType
|
||||
OP: TokenType
|
||||
ENDMARKER: TokenType
|
||||
|
||||
PythonTokenTypes: _FakePythonTokenTypesClass = ...
|
||||
Reference in New Issue
Block a user