From b816c00e77aed2f84ca2af75e17067cebcf614aa Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 25 Jul 2020 16:12:04 +0200 Subject: [PATCH] Remove the token stub in favor of inline annotations --- parso/python/token.py | 5 ++++- parso/python/token.pyi | 30 ------------------------------ 2 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 parso/python/token.pyi diff --git a/parso/python/token.py b/parso/python/token.py index be2b13c..eda08f1 100644 --- a/parso/python/token.py +++ b/parso/python/token.py @@ -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 diff --git a/parso/python/token.pyi b/parso/python/token.pyi deleted file mode 100644 index 48e8dac..0000000 --- a/parso/python/token.pyi +++ /dev/null @@ -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 = ...