mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
chore: enforce more ruff rules (#31447)
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9da65d6bfd
commit
e51b95ffa8
@@ -318,7 +318,7 @@ class ParsedQuery:
|
||||
return False
|
||||
return True
|
||||
|
||||
def is_select(self) -> bool:
|
||||
def is_select(self) -> bool: # noqa: C901
|
||||
# make sure we strip comments; prevents a bug with comments in the CTE
|
||||
parsed = sqlparse.parse(self.strip_comments())
|
||||
seen_select = False
|
||||
@@ -333,7 +333,7 @@ class ParsedQuery:
|
||||
):
|
||||
return False
|
||||
except ValueError:
|
||||
# sqloxide was not able to parse the query, so let's continue with
|
||||
# sqloxide was not able to parse the query, so let's continue with # noqa: E501
|
||||
# sqlparse
|
||||
pass
|
||||
inner_cte = self.get_inner_cte_expression(statement.tokens) or []
|
||||
@@ -753,7 +753,7 @@ def insert_rls_as_subquery(
|
||||
return token_list
|
||||
|
||||
|
||||
def insert_rls_in_predicate(
|
||||
def insert_rls_in_predicate( # noqa: C901
|
||||
token_list: TokenList,
|
||||
database_id: int,
|
||||
default_schema: str | None,
|
||||
@@ -807,7 +807,7 @@ def insert_rls_in_predicate(
|
||||
)
|
||||
state = InsertRLSState.SCANNING
|
||||
|
||||
# Found ON clause, insert RLS. The logic for ON is more complicated than the logic
|
||||
# Found ON clause, insert RLS. The logic for ON is more complicated than the logic # noqa: E501
|
||||
# for WHERE because in the former the comparisons are siblings, while on the
|
||||
# latter they are children.
|
||||
elif (
|
||||
@@ -899,7 +899,7 @@ RE_JINJA_VAR = re.compile(r"\{\{[^\{\}]+\}\}")
|
||||
RE_JINJA_BLOCK = re.compile(r"\{[%#][^\{\}%#]+[%#]\}")
|
||||
|
||||
|
||||
def extract_table_references(
|
||||
def extract_table_references( # noqa: C901
|
||||
sql_text: str, sqla_dialect: str, show_warning: bool = True
|
||||
) -> set[Table]:
|
||||
"""
|
||||
@@ -909,7 +909,7 @@ def extract_table_references(
|
||||
tree = None
|
||||
|
||||
if sqloxide_parse:
|
||||
for dialect, sqla_dialects in SQLOXIDE_DIALECTS.items():
|
||||
for dialect, sqla_dialects in SQLOXIDE_DIALECTS.items(): # noqa: B007
|
||||
if sqla_dialect in sqla_dialects:
|
||||
break
|
||||
sql_text = RE_JINJA_BLOCK.sub(" ", sql_text)
|
||||
|
||||
Reference in New Issue
Block a user