Skip to content

Commit 8515d2e

Browse files
mrmasterplanandialbrecht
authored andcommitted
remove type annotations for python 3.5 compatibility
1 parent e37eaea commit 8515d2e

3 files changed

Lines changed: 2 additions & 13 deletions

File tree

sqlparse/keywords.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@
66
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
77

88
import re
9-
from typing import Dict, List, Tuple, Callable, Union
109

1110
from sqlparse import tokens
1211

1312
# object() only supports "is" and is useful as a marker
1413
PROCESS_AS_KEYWORD = object()
1514

16-
SQL_REGEX_TYPE = List[
17-
Tuple[Callable, Union[type(PROCESS_AS_KEYWORD), tokens._TokenType]]
18-
]
19-
KEYWORDS_TYPE = Dict[str, tokens._TokenType]
20-
2115

2216
SQL_REGEX = {
2317
'root': [

sqlparse/lexer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# and to allow some customizations.
1414

1515
from io import TextIOBase
16-
from typing import List
1716

1817
from sqlparse import tokens, keywords
1918
from sqlparse.utils import consume
@@ -34,9 +33,6 @@ class Lexer(metaclass=_LexerSingletonMetaclass):
3433
"""The Lexer supports configurable syntax.
3534
To add support for additional keywords, use the `add_keywords` method."""
3635

37-
_SQL_REGEX: keywords.SQL_REGEX_TYPE
38-
_keywords: List[keywords.KEYWORDS_TYPE]
39-
4036
def default_initialization(self):
4137
"""Initialize the lexer with default dictionaries.
4238
Useful if you need to revert custom syntax settings."""
@@ -58,11 +54,11 @@ def clear(self):
5854
self._SQL_REGEX = []
5955
self._keywords = []
6056

61-
def set_SQL_REGEX(self, SQL_REGEX: keywords.SQL_REGEX_TYPE):
57+
def set_SQL_REGEX(self, SQL_REGEX):
6258
"""Set the list of regex that will parse the SQL."""
6359
self._SQL_REGEX = SQL_REGEX
6460

65-
def add_keywords(self, keywords: keywords.KEYWORDS_TYPE):
61+
def add_keywords(self, keywords):
6662
"""Add keyword dictionaries. Keywords are looked up in the same order
6763
that dictionaries were added."""
6864
self._keywords.append(keywords)

tests/test_parse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ def test_parenthesis():
494494

495495
def test_configurable_syntax():
496496
sql = """select * from foo BACON SPAM EGGS;"""
497-
# sql="""select * from mydb.mytable BACON SPAM EGGS;"""
498497
tokens = sqlparse.parse(sql)[0]
499498

500499
assert list(

0 commit comments

Comments
 (0)