This is an automated email from the ASF dual-hosted git repository.
yjc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 8d0d778d1a chore(mypy): enable warn_unused_ignores (#20884)
8d0d778d1a is described below
commit 8d0d778d1a00f8f06103c001c071f5a012a40649
Author: John Bodley <[email protected]>
AuthorDate: Fri Jul 29 00:47:53 2022 -0700
chore(mypy): enable warn_unused_ignores (#20884)
---
setup.cfg | 2 +-
superset/models/helpers.py | 14 +++++++-------
superset/utils/core.py | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/setup.cfg b/setup.cfg
index 6f667677ec..7f2f83c18e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -41,7 +41,7 @@ disallow_untyped_calls = true
disallow_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
-warn_unused_ignores = false
+warn_unused_ignores = true
[mypy-superset.migrations.versions.*]
ignore_errors = true
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 66055f33b2..d549158e66 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -750,7 +750,7 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
def get_extra_cache_keys(query_obj: Dict[str, Any]) -> List[str]:
raise NotImplementedError()
- def _process_sql_expression( # type: ignore # pylint: disable=no-self-use
+ def _process_sql_expression( # pylint: disable=no-self-use
self,
expression: Optional[str],
database_id: int,
@@ -1061,7 +1061,7 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
sqla_column = sa.column(column_name)
sqla_metric =
self.sqla_aggregations[metric["aggregate"]](sqla_column)
elif expression_type == utils.AdhocMetricExpressionType.SQL:
- expression = self._process_sql_expression( # type: ignore
+ expression = self._process_sql_expression(
expression=metric["sqlExpression"],
database_id=self.database_id,
schema=self.schema,
@@ -1170,8 +1170,8 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
:rtype: sqlalchemy.sql.column
"""
label = utils.get_column_name(col) # type: ignore
- expression = self._process_sql_expression( # type: ignore
- expression=col["sqlExpression"], # type: ignore
+ expression = self._process_sql_expression(
+ expression=col["sqlExpression"],
database_id=self.database_id,
schema=self.schema,
template_processor=template_processor,
@@ -1351,7 +1351,7 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
metrics_exprs.append(
self.adhoc_metric_to_sqla(
metric=metric,
- columns_by_name=columns_by_name, # type: ignore
+ columns_by_name=columns_by_name,
template_processor=template_processor,
)
)
@@ -1379,7 +1379,7 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
if isinstance(col, dict):
col = cast(AdhocMetric, col)
if col.get("sqlExpression"):
- col["sqlExpression"] = self._process_sql_expression( #
type: ignore
+ col["sqlExpression"] = self._process_sql_expression(
expression=col["sqlExpression"],
database_id=self.database_id,
schema=self.schema,
@@ -1387,7 +1387,7 @@ class ExploreMixin: # pylint:
disable=too-many-public-methods
)
if utils.is_adhoc_metric(col):
# add adhoc sort by column to columns_by_name if not exists
- col = self.adhoc_metric_to_sqla(col, columns_by_name) #
type: ignore
+ col = self.adhoc_metric_to_sqla(col, columns_by_name)
# if the adhoc metric has been defined before
# use the existing instance.
col = metrics_exprs_by_expr.get(str(col), col)
diff --git a/superset/utils/core.py b/superset/utils/core.py
index 6ce5a8a831..8298f47832 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -1689,7 +1689,7 @@ def extract_dataframe_dtypes(
column_object = columns_by_name.get(column)
series = df[column]
inferred_type = infer_dtype(series)
- if isinstance(column_object, dict): # type: ignore
+ if isinstance(column_object, dict):
generic_type = (
GenericDataType.TEMPORAL
if column_object and column_object.get("is_dttm")