chore: Mypy fix **kwargs type (#15823)

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley 2021-07-28 09:59:20 -07:00 committed by GitHub
parent 3adf8e85cd
commit 671b8f2544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 13 deletions

View File

@ -137,7 +137,7 @@ class AnnotationRestApi(BaseSupersetModelRestApi):
@permission_name("get") @permission_name("get")
@rison(get_list_schema) @rison(get_list_schema)
def get_list( # pylint: disable=arguments-differ def get_list( # pylint: disable=arguments-differ
self, pk: int, **kwargs: Dict[str, Any] self, pk: int, **kwargs: Any
) -> Response: ) -> Response:
"""Get a list of annotations """Get a list of annotations
--- ---
@ -198,7 +198,7 @@ class AnnotationRestApi(BaseSupersetModelRestApi):
@permission_name("get") @permission_name("get")
@rison(get_item_schema) @rison(get_item_schema)
def get( # pylint: disable=arguments-differ def get( # pylint: disable=arguments-differ
self, pk: int, annotation_id: int, **kwargs: Dict[str, Any] self, pk: int, annotation_id: int, **kwargs: Any
) -> Response: ) -> Response:
"""Get item from Model """Get item from Model
--- ---

View File

@ -814,7 +814,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
f".cache_screenshot", f".cache_screenshot",
log_to_statsd=False, log_to_statsd=False,
) )
def cache_screenshot(self, pk: int, **kwargs: Dict[str, bool]) -> WerkzeugResponse: def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse:
""" """
--- ---
get: get:
@ -946,9 +946,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.thumbnail", action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.thumbnail",
log_to_statsd=False, log_to_statsd=False,
) )
def thumbnail( def thumbnail(self, pk: int, digest: str, **kwargs: Any) -> WerkzeugResponse:
self, pk: int, digest: str, **kwargs: Dict[str, bool]
) -> WerkzeugResponse:
"""Get Chart thumbnail """Get Chart thumbnail
--- ---
get: get:

View File

@ -18,7 +18,7 @@ import json
import logging import logging
from datetime import datetime from datetime import datetime
from io import BytesIO from io import BytesIO
from typing import Any, Dict, Optional from typing import Any, Optional
from zipfile import is_zipfile, ZipFile from zipfile import is_zipfile, ZipFile
from flask import g, make_response, redirect, request, Response, send_file, url_for from flask import g, make_response, redirect, request, Response, send_file, url_for
@ -755,9 +755,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.thumbnail", action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.thumbnail",
log_to_statsd=False, log_to_statsd=False,
) )
def thumbnail( def thumbnail(self, pk: int, digest: str, **kwargs: Any) -> WerkzeugResponse:
self, pk: int, digest: str, **kwargs: Dict[str, bool]
) -> WerkzeugResponse:
"""Get Dashboard thumbnail """Get Dashboard thumbnail
--- ---
get: get:

View File

@ -97,7 +97,7 @@ class ReportExecutionLogRestApi(BaseSupersetModelRestApi):
@permission_name("get") @permission_name("get")
@rison(get_list_schema) @rison(get_list_schema)
def get_list( # pylint: disable=arguments-differ def get_list( # pylint: disable=arguments-differ
self, pk: int, **kwargs: Dict[str, Any] self, pk: int, **kwargs: Any
) -> Response: ) -> Response:
"""Get a list of report schedule logs """Get a list of report schedule logs
--- ---
@ -158,7 +158,7 @@ class ReportExecutionLogRestApi(BaseSupersetModelRestApi):
@permission_name("get") @permission_name("get")
@rison(get_item_schema) @rison(get_item_schema)
def get( # pylint: disable=arguments-differ def get( # pylint: disable=arguments-differ
self, pk: int, log_id: int, **kwargs: Dict[str, Any] self, pk: int, log_id: int, **kwargs: Any
) -> Response: ) -> Response:
"""Get a report schedule log """Get a report schedule log
--- ---

View File

@ -44,7 +44,7 @@ def stats_timing(stats_key: str, stats_logger: BaseStatsLogger) -> Iterator[floa
stats_logger.timing(stats_key, now_as_float() - start_ts) stats_logger.timing(stats_key, now_as_float() - start_ts)
def arghash(args: Any, kwargs: Dict[str, Any]) -> int: def arghash(args: Any, kwargs: Any) -> int:
"""Simple argument hash with kwargs sorted.""" """Simple argument hash with kwargs sorted."""
sorted_args = tuple( sorted_args = tuple(
x if hasattr(x, "__repr__") else x for x in [*args, *sorted(kwargs.items())] x if hasattr(x, "__repr__") else x for x in [*args, *sorted(kwargs.items())]