From 9529337341757854037418ba690ff0e4fe681225 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Wed, 27 Jul 2022 01:10:05 -0700 Subject: [PATCH] Update setup.cfg --- 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 6f667677ec810..7f2f83c18e7db 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 66055f33b226e..d549158e664e3 100644 --- a/superset/models/helpers.py +++ b/superset/models/helpers.py @@ -750,7 +750,7 @@ def get_fetch_values_predicate(self) -> List[Any]: 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 @@ def adhoc_metric_to_sqla( 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 @@ def adhoc_column_to_sqla( :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 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma 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 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma 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 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma ) 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 6ce5a8a831c0c..8298f478320f8 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")