summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Heisterkamp <simon@heisterkamp.dk>2022-11-30 15:00:03 +0000
committerAndi Albrecht <albrecht.andi@gmail.com>2023-01-02 08:54:47 +0100
commit8515d2edd70fc16d69aa7b1094f9b3534dfa74d9 (patch)
tree867c9b95562c24796c63089cbf846247f87f02e5
parente37eaea4a78cbb335070ffec018bfc28425aa1a4 (diff)
downloadsqlparse-8515d2edd70fc16d69aa7b1094f9b3534dfa74d9.tar.gz
remove type annotations for python 3.5 compatibility
-rw-r--r--sqlparse/keywords.py6
-rw-r--r--sqlparse/lexer.py8
-rw-r--r--tests/test_parse.py1
3 files changed, 2 insertions, 13 deletions
diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py
index ce53781..6bc7937 100644
--- a/sqlparse/keywords.py
+++ b/sqlparse/keywords.py
@@ -6,18 +6,12 @@
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
import re
-from typing import Dict, List, Tuple, Callable, Union
from sqlparse import tokens
# object() only supports "is" and is useful as a marker
PROCESS_AS_KEYWORD = object()
-SQL_REGEX_TYPE = List[
- Tuple[Callable, Union[type(PROCESS_AS_KEYWORD), tokens._TokenType]]
-]
-KEYWORDS_TYPE = Dict[str, tokens._TokenType]
-
SQL_REGEX = {
'root': [
diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py
index 61c52a9..7408e01 100644
--- a/sqlparse/lexer.py
+++ b/sqlparse/lexer.py
@@ -13,7 +13,6 @@
# and to allow some customizations.
from io import TextIOBase
-from typing import List
from sqlparse import tokens, keywords
from sqlparse.utils import consume
@@ -34,9 +33,6 @@ class Lexer(metaclass=_LexerSingletonMetaclass):
"""The Lexer supports configurable syntax.
To add support for additional keywords, use the `add_keywords` method."""
- _SQL_REGEX: keywords.SQL_REGEX_TYPE
- _keywords: List[keywords.KEYWORDS_TYPE]
-
def default_initialization(self):
"""Initialize the lexer with default dictionaries.
Useful if you need to revert custom syntax settings."""
@@ -58,11 +54,11 @@ class Lexer(metaclass=_LexerSingletonMetaclass):
self._SQL_REGEX = []
self._keywords = []
- def set_SQL_REGEX(self, SQL_REGEX: keywords.SQL_REGEX_TYPE):
+ def set_SQL_REGEX(self, SQL_REGEX):
"""Set the list of regex that will parse the SQL."""
self._SQL_REGEX = SQL_REGEX
- def add_keywords(self, keywords: keywords.KEYWORDS_TYPE):
+ def add_keywords(self, keywords):
"""Add keyword dictionaries. Keywords are looked up in the same order
that dictionaries were added."""
self._keywords.append(keywords)
diff --git a/tests/test_parse.py b/tests/test_parse.py
index c5dfd36..3018d9a 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -494,7 +494,6 @@ def test_parenthesis():
def test_configurable_syntax():
sql = """select * from foo BACON SPAM EGGS;"""
- # sql="""select * from mydb.mytable BACON SPAM EGGS;"""
tokens = sqlparse.parse(sql)[0]
assert list(