Skip to content

Commit

Permalink
chore(mypy): enable warn_unused_ignores (#20884)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-bodley authored Jul 29, 2022
1 parent 50d2e5a commit 8d0d778
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions superset/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
)
)
Expand Down Expand Up @@ -1379,15 +1379,15 @@ 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,
template_processor=template_processor,
)
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)
Expand Down
2 changes: 1 addition & 1 deletion superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8d0d778

Please sign in to comment.