From 12c3628dbc6a78afef02eff3376649e519d0d8cc Mon Sep 17 00:00:00 2001 From: "yuhang.wang" Date: Fri, 14 Jun 2024 16:17:54 +0800 Subject: [PATCH] Pylint --- sql_metadata/parser.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/sql_metadata/parser.py b/sql_metadata/parser.py index cf704878..dd4457e8 100644 --- a/sql_metadata/parser.py +++ b/sql_metadata/parser.py @@ -85,19 +85,6 @@ def query(self) -> str: """ return self._query.replace("\n", " ").replace(" ", " ") - @staticmethod - def get_switch_by_create_query(tokens: List[SQLToken], index: int) -> str: - switch = tokens[index].normalized + tokens[index + 1].normalized - - # Hive CREATE FUNCTION - if any( - index + i < len(tokens) and tokens[index + i].normalized == "FUNCTION" - for i in (1, 2) - ): - switch = "CREATEFUNCTION" - - return switch - @property def query_type(self) -> str: """ @@ -1094,3 +1081,19 @@ def _flatten_sqlparse(self): yield tok else: yield token + + @staticmethod + def _get_switch_by_create_query(tokens: List[SQLToken], index: int) -> str: + """ + Return the switch that creates query type. + """ + switch = tokens[index].normalized + tokens[index + 1].normalized + + # Hive CREATE FUNCTION + if any( + index + i < len(tokens) and tokens[index + i].normalized == "FUNCTION" + for i in (1, 2) + ): + switch = "CREATEFUNCTION" + + return switch