Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

other(mypy): Enable warn_unused_ignores #20884

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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