chore: upgrade mypy (#19227)

This commit is contained in:
Jesse Yang 2022-03-17 10:35:53 -07:00 committed by GitHub
parent c345029fbc
commit 92cd0a18e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 16 additions and 23 deletions

View File

@ -20,7 +20,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
rev: v0.941
hooks:
- id: mypy
additional_dependencies: [types-all]

View File

@ -381,12 +381,12 @@ def change_log(
with open(csv, "w") as csv_file:
log_items = list(logs)
field_names = log_items[0].keys()
writer = lib_csv.DictWriter( # type: ignore
writer = lib_csv.DictWriter(
csv_file,
delimiter=",",
quotechar='"',
quoting=lib_csv.QUOTE_ALL,
fieldnames=field_names, # type: ignore
fieldnames=field_names,
)
writer.writeheader()
for log in logs:

View File

@ -306,16 +306,13 @@ class ChartDataRestApi(ChartRestApi):
Execute command as an async query.
"""
# First, look for the chart query results in the cache.
result = None
try:
result = command.run(force_cached=True)
if result is not None:
return self._send_chart_response(result)
except ChartDataCacheLoadError:
result = None # type: ignore
already_cached_result = result is not None
# If the chart query has already been cached, return it immediately.
if already_cached_result:
return self._send_chart_response(result)
pass
# Otherwise, kick off a background job to run the chart query.
# Clients will either poll or be notified of query completion,

View File

@ -45,7 +45,7 @@ def superset() -> None:
# add sub-commands
for load, module_name, is_pkg in pkgutil.walk_packages(
cli.__path__, cli.__name__ + "." # type: ignore
cli.__path__, cli.__name__ + "."
):
module = importlib.import_module(module_name)
for attribute in module.__dict__.values():

View File

@ -221,7 +221,7 @@ class ImportExportMixin:
if not obj:
is_new_obj = True
# Create new DB object
obj = cls(**dict_rep) # type: ignore
obj = cls(**dict_rep)
logger.info("Importing new %s %s", obj.__tablename__, str(obj))
if cls.export_parent and parent:
setattr(obj, cls.export_parent, parent)

View File

@ -77,8 +77,7 @@ class AlertCommand(BaseCommand):
threshold = json.loads(self._report_schedule.validator_config_json)[
"threshold"
]
return OPERATOR_FUNCTIONS[operator](self._result, threshold)
return OPERATOR_FUNCTIONS[operator](self._result, threshold) # type: ignore
except (KeyError, json.JSONDecodeError) as ex:
raise AlertValidatorConfigError() from ex

View File

@ -50,7 +50,7 @@ class BaseNotification: # pylint: disable=too-few-public-methods
"""
def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None:
super().__init_subclass__(*args, **kwargs) # type: ignore
super().__init_subclass__(*args, **kwargs)
cls.plugins.append(cls)
def __init__(

View File

@ -71,7 +71,7 @@ class AsyncQueryManager:
def __init__(self) -> None:
super().__init__()
self._redis: redis.Redis
self._redis: redis.Redis # type: ignore
self._stream_prefix: str = ""
self._stream_limit: Optional[int]
self._stream_limit_firehose: Optional[int]

View File

@ -653,14 +653,11 @@ class Superset(BaseSupersetView): # pylint: disable=too-many-public-methods
force=force,
)
payload = viz_obj.get_payload()
# If the chart query has already been cached, return it immediately.
if payload is not None:
return self.send_data_payload_response(viz_obj, payload)
except CacheLoadError:
payload = None # type: ignore
already_cached_result = payload is not None
# If the chart query has already been cached, return it immediately.
if already_cached_result:
return self.send_data_payload_response(viz_obj, payload)
pass
# Otherwise, kick off a background job to run the chart query.
# Clients will either poll or be notified of query completion,