Remove the token stub in favor of inline annotations

This commit is contained in:
Dave Halter
2020-07-25 16:12:04 +02:00
parent 2197e4c9e8
commit b816c00e77
2 changed files with 4 additions and 31 deletions

View File

@@ -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

View File

@@ -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 = ...