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 2025/05/21 17:38:20 UTC

(superset) 01/01: chore: remove useless-suppression

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

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

commit b5f2bd99f80a1d25dbf18efeb323f30c0698165b
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Wed May 21 13:37:58 2025 -0400

    chore: remove useless-suppression
---
 superset/commands/sql_lab/execute.py |  2 +-
 superset/config.py                   |  2 +-
 superset/examples/flights.py         |  6 +++---
 superset/models/core.py              |  1 -
 superset/utils/date_parser.py        | 26 +++++++++++++-------------
 5 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/superset/commands/sql_lab/execute.py b/superset/commands/sql_lab/execute.py
index 001d5609db..20cba40cfc 100644
--- a/superset/commands/sql_lab/execute.py
+++ b/superset/commands/sql_lab/execute.py
@@ -92,7 +92,7 @@ class ExecuteSqlCommand(BaseCommand):
         pass
 
     @transaction()
-    def run(  # pylint: disable=too-many-statements,useless-suppression
+    def run(
         self,
     ) -> CommandResult:
         """Runs arbitrary sql and returns data as json"""
diff --git a/superset/config.py b/superset/config.py
index a01c380a7e..ee6f620b94 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -1299,7 +1299,7 @@ TRACKING_URL_TRANSFORMER = lambda url: url  # noqa: E731
 DB_POLL_INTERVAL_SECONDS: dict[str, int] = {}
 
 # Interval between consecutive polls when using Presto Engine
-# See here: https://github.com/dropbox/PyHive/blob/8eb0aeab8ca300f3024655419b93dad926c1a351/pyhive/presto.py#L93  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+# See here: https://github.com/dropbox/PyHive/blob/8eb0aeab8ca300f3024655419b93dad926c1a351/pyhive/presto.py#L93  # noqa: E501
 PRESTO_POLL_INTERVAL = int(timedelta(seconds=1).total_seconds())
 
 # Allow list of custom authentications for each DB engine.
diff --git a/superset/examples/flights.py b/superset/examples/flights.py
index 4d8b04e42a..b996fafcbb 100644
--- a/superset/examples/flights.py
+++ b/superset/examples/flights.py
@@ -47,9 +47,9 @@ def load_flights(only_metadata: bool = False, force: bool = False) -> None:
             )
             airports = airports.set_index("IATA_CODE")
 
-            pdf[  # pylint: disable=unsupported-assignment-operation,useless-suppression
-                "ds"
-            ] = pdf.YEAR.map(str) + "-0" + pdf.MONTH.map(str) + "-0" + pdf.DAY.map(str)
+            pdf["ds"] = (
+                pdf.YEAR.map(str) + "-0" + pdf.MONTH.map(str) + "-0" + pdf.DAY.map(str)
+            )
             pdf.ds = pd.to_datetime(pdf.ds)
             pdf.drop(columns=["DAY", "MONTH", "YEAR"])
             pdf = pdf.join(airports, on="ORIGIN_AIRPORT", rsuffix="_ORIG")
diff --git a/superset/models/core.py b/superset/models/core.py
index 9378452bd8..e1322be6f2 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -307,7 +307,6 @@ class Database(Model, AuditMixinNullable, ImportExportMixin):  # pylint: disable
             with suppress(TypeError, json.JSONDecodeError):
                 encrypted_config = json.loads(masked_encrypted_extra)
         try:
-            # pylint: disable=useless-suppression
             parameters = self.db_engine_spec.get_parameters_from_uri(  # type: ignore
                 masked_uri,
                 encrypted_extra=encrypted_config,
diff --git a/superset/utils/date_parser.py b/superset/utils/date_parser.py
index 585c837f9d..2db8deb1ec 100644
--- a/superset/utils/date_parser.py
+++ b/superset/utils/date_parser.py
@@ -77,7 +77,7 @@ def parse_human_datetime(human_readable: str) -> datetime:
 
 
 def normalize_time_delta(human_readable: str) -> dict[str, int]:
-    x_unit = r"^\s*([0-9]+)\s+(second|minute|hour|day|week|month|quarter|year)s?\s+(ago|later)*$"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+    x_unit = r"^\s*([0-9]+)\s+(second|minute|hour|day|week|month|quarter|year)s?\s+(ago|later)*$"  # noqa: E501
     matched = re.match(x_unit, human_readable, re.IGNORECASE)
     if not matched:
         raise TimeDeltaAmbiguousError(human_readable)
@@ -362,13 +362,13 @@ def get_since_until(  # pylint: disable=too-many-arguments,too-many-locals,too-m
         and time_range.startswith("previous calendar week")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, WEEK), WEEK) : DATETRUNC(DATETIME('today'), WEEK)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, WEEK), WEEK) : DATETRUNC(DATETIME('today'), WEEK)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("previous calendar month")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, MONTH), MONTH) : DATETRUNC(DATETIME('today'), MONTH)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, MONTH), MONTH) : DATETRUNC(DATETIME('today'), MONTH)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("previous calendar quarter")
@@ -376,44 +376,44 @@ def get_since_until(  # pylint: disable=too-many-arguments,too-many-locals,too-m
     ):
         time_range = (
             "DATETRUNC(DATEADD(DATETIME('today'), -1, QUARTER), QUARTER) : "
-            "DATETRUNC(DATETIME('today'), QUARTER)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+            "DATETRUNC(DATETIME('today'), QUARTER)"  # noqa: E501
         )
     if (
         time_range
         and time_range.startswith("previous calendar year")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, YEAR), YEAR) : DATETRUNC(DATETIME('today'), YEAR)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), -1, YEAR), YEAR) : DATETRUNC(DATETIME('today'), YEAR)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("Current day")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, DAY), DAY) : DATETRUNC(DATEADD(DATETIME('today'), 1, DAY), DAY)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, DAY), DAY) : DATETRUNC(DATEADD(DATETIME('today'), 1, DAY), DAY)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("Current week")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, WEEK), WEEK) : DATETRUNC(DATEADD(DATETIME('today'), 1, WEEK), WEEK)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, WEEK), WEEK) : DATETRUNC(DATEADD(DATETIME('today'), 1, WEEK), WEEK)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("Current month")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, MONTH), MONTH) : DATETRUNC(DATEADD(DATETIME('today'), 1, MONTH), MONTH)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, MONTH), MONTH) : DATETRUNC(DATEADD(DATETIME('today'), 1, MONTH), MONTH)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("Current quarter")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, QUARTER), QUARTER) : DATETRUNC(DATEADD(DATETIME('today'), 1, QUARTER), QUARTER)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, QUARTER), QUARTER) : DATETRUNC(DATEADD(DATETIME('today'), 1, QUARTER), QUARTER)"  # noqa: E501
     if (
         time_range
         and time_range.startswith("Current year")
         and separator not in time_range
     ):
-        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, YEAR), YEAR) : DATETRUNC(DATEADD(DATETIME('today'), 1, YEAR), YEAR)"  # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+        time_range = "DATETRUNC(DATEADD(DATETIME('today'), 0, YEAR), YEAR) : DATETRUNC(DATEADD(DATETIME('today'), 1, YEAR), YEAR)"  # noqa: E501
 
     if time_range and separator in time_range:
         time_range_lookup = [
@@ -421,7 +421,7 @@ def get_since_until(  # pylint: disable=too-many-arguments,too-many-locals,too-m
                 r"^(start of|beginning of|end of)\s+"
                 r"(this|last|next|prior)\s+"
                 r"([0-9]+)?\s*"
-                r"(day|week|month|quarter|year)s?$",  # Matches phrases like "start of next month" # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+                r"(day|week|month|quarter|year)s?$",  # Matches phrases like "start of next month" # noqa: E501
                 lambda modifier, scope, delta, unit: handle_modifier_and_unit(
                     modifier,
                     scope,
@@ -433,13 +433,13 @@ def get_since_until(  # pylint: disable=too-many-arguments,too-many-locals,too-m
             (
                 r"^(this|last|next|prior)\s+"
                 r"([0-9]+)?\s*"
-                r"(second|minute|day|week|month|quarter|year)s?$",  # Matches "next 5 days" or "last 2 weeks" # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+                r"(second|minute|day|week|month|quarter|year)s?$",  # Matches "next 5 days" or "last 2 weeks" # noqa: E501
                 lambda scope, delta, unit: handle_scope_and_unit(
                     scope, delta, unit, get_relative_base(unit, relative_start)
                 ),
             ),
             (
-                r"^(DATETIME.*|DATEADD.*|DATETRUNC.*|LASTDAY.*|HOLIDAY.*)$",  # Matches date-related keywords # pylint: disable=line-too-long,useless-suppression  # noqa: E501
+                r"^(DATETIME.*|DATEADD.*|DATETRUNC.*|LASTDAY.*|HOLIDAY.*)$",  # Matches date-related keywords # noqa: E501
                 lambda text: text,
             ),
         ]