You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/08/08 18:20:16 UTC

[superset] 01/01: Fix lint

This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch db-diagnostics
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 6ff44ff7823e2e484511900dd2f754a7bddc0063
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Aug 8 10:20:04 2023 -0700

    Fix lint
---
 superset/cli/test_db.py            |  4 +++-
 superset/db_engine_specs/README.md |  2 +-
 superset/db_engine_specs/lib.py    | 22 ++++++++++++++++------
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/superset/cli/test_db.py b/superset/cli/test_db.py
index 1b968384ec..948177093a 100644
--- a/superset/cli/test_db.py
+++ b/superset/cli/test_db.py
@@ -265,6 +265,7 @@ def test_db_engine_spec(
         score = " (+10)" if info[k] else ""
         console.print(f"{v}: {info[k]}{score}")
 
+    # pylint: disable=consider-using-f-string
     console.print("[bold]Overall score: {score}/{max_score}".format(**info))
 
     return spec
@@ -330,6 +331,7 @@ def test_sqlalchemy_dialect(
     return engine
 
 
+# pylint: disable=too-many-statements
 def test_database_connectivity(console: Console, engine: Engine) -> None:
     """
     Tests the DB API 2.0 driver.
@@ -337,7 +339,7 @@ def test_database_connectivity(console: Console, engine: Engine) -> None:
     with console.status("[bold green]Connecting to database..."):
         try:
             conn = engine.raw_connection()
-            engine.dialect.do_ping(conn)  # pylint: disable=attr-defined
+            engine.dialect.do_ping(conn)
             console.print(":thumbs_up: [green]Connected successfully!")
         except Exception as ex:  # pylint: disable=broad-except
             console.print(f":thumbs_down: [red]Failed to connect: {ex}")
diff --git a/superset/db_engine_specs/README.md b/superset/db_engine_specs/README.md
index 1abee1de5c..1744160768 100644
--- a/superset/db_engine_specs/README.md
+++ b/superset/db_engine_specs/README.md
@@ -613,7 +613,7 @@ COLUMN_DOES_NOT_EXIST_REGEX = re.compile("no such column: (?P<column_name>.+)")
 
 class SqliteEngineSpec(BaseEngineSpec):
 
-    custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, Any]]] = 
+    custom_errors: dict[Pattern[str], tuple[str, SupersetErrorType, dict[str, Any]]] =
         COLUMN_DOES_NOT_EXIST_REGEX: (
             __('We can\'t seem to resolve the column "%(column_name)s"'),
             SupersetErrorType.COLUMN_DOES_NOT_EXIST_ERROR,
diff --git a/superset/db_engine_specs/lib.py b/superset/db_engine_specs/lib.py
index b2de4b6dd4..584cc4299c 100644
--- a/superset/db_engine_specs/lib.py
+++ b/superset/db_engine_specs/lib.py
@@ -24,9 +24,13 @@ from superset.db_engine_specs import load_engine_specs
 from superset.db_engine_specs.base import BaseEngineSpec
 
 LIMIT_METHODS = {
-    "FORCE_LIMIT": "modifies the query, replacing an existing LIMIT or adding a new one",  # E: line too long (89 > 79 characters)
+    "FORCE_LIMIT": (
+        "modifies the query, replacing an existing LIMIT or adding a new one"
+    ),  # E: line too long (89 > 79 characters)
     "WRAP_SQL": "wraps the original query in a SELECT * with a LIMIT",
-    "FETCH_MANY": "runs the query unmodified but fetchs only LIMIT rows from the cursor",  # E: line too long (89 > 79 characters)
+    "FETCH_MANY": (
+        "runs the query unmodified but fetchs only LIMIT rows from the cursor"
+    ),  # E: line too long (89 > 79 characters)
 }
 
 DATABASE_DETAILS = {
@@ -36,9 +40,15 @@ DATABASE_DETAILS = {
     "alias_in_select": "Allows aliases in the SELECT statement",
     "alias_in_orderby": "Allows referencing aliases in the ORDER BY statement",
     "secondary_time_columns": "Supports secondary time columns",
-    "time_groupby_inline": "Allows ommiting time filters from inline GROUP BYs",  # E: line too long (80 > 79 characters)
-    "alias_to_source_column": "Able to use source column when an alias overshadows it",  # E: line too long (87 > 79 characters)
-    "order_by_not_in_select": "Allows aggregations in ORDER BY not present in the SELECT",  # E: line too long (90 > 79 characters)
+    "time_groupby_inline": (
+        "Allows ommiting time filters from inline GROUP BYs"
+    ),  # E: line too long (80 > 79 characters)
+    "alias_to_source_column": (
+        "Able to use source column when an alias overshadows it"
+    ),  # E: line too long (87 > 79 characters)
+    "order_by_not_in_select": (
+        "Allows aggregations in ORDER BY not present in the SELECT"
+    ),  # E: line too long (90 > 79 characters)
     "expressions_in_orderby": "Allows expressions in ORDER BY",
     "cte_in_subquery": "Allows CTE as a subquery",
     "limit_clause": "Allows LIMIT clause (instead of TOP)",
@@ -210,7 +220,7 @@ def generate_table() -> list[list[Any]]:
     # remove 3rd party DB engine specs
     info = {k: v for k, v in info.items() if v["module"].startswith("superset")}
 
-    rows = []
+    rows = []  # pylint: disable=redefined-outer-name
     rows.append(["Feature"] + list(info))  # header row
     rows.append(["Module"] + list(db_info["module"] for db_info in info.values()))