chore(pre-commit): Add pyupgrade and pycln hooks (#24197)

This commit is contained in:
John Bodley
2023-06-01 12:01:10 -07:00
committed by GitHub
parent 7d7ce63970
commit a4d5d7c6b9
448 changed files with 3084 additions and 3305 deletions

View File

@@ -16,7 +16,7 @@
# under the License.
import copy
import dataclasses
from typing import Any, Dict, List, Optional
from typing import Any, Optional
from superset.common.chart_data import ChartDataResultType
from superset.utils.core import AnnotationType, DTTM_ALIAS
@@ -42,7 +42,7 @@ query_birth_names = {
"where": "",
}
QUERY_OBJECTS: Dict[str, Dict[str, object]] = {
QUERY_OBJECTS: dict[str, dict[str, object]] = {
"birth_names": query_birth_names,
# `:suffix` are overrides only
"birth_names:include_time": {
@@ -205,7 +205,7 @@ def get_query_object(
query_name: str,
add_postprocessing_operations: bool,
add_time_offsets: bool,
) -> Dict[str, Any]:
) -> dict[str, Any]:
if query_name not in QUERY_OBJECTS:
raise Exception(f"QueryObject fixture not defined for datasource: {query_name}")
obj = QUERY_OBJECTS[query_name]
@@ -227,7 +227,7 @@ def get_query_object(
return query_object
def _get_postprocessing_operation(query_name: str) -> List[Dict[str, Any]]:
def _get_postprocessing_operation(query_name: str) -> list[dict[str, Any]]:
if query_name not in QUERY_OBJECTS:
raise Exception(
f"Post-processing fixture not defined for datasource: {query_name}"
@@ -250,8 +250,8 @@ class QueryContextGenerator:
add_time_offsets: bool = False,
table_id=1,
table_type="table",
form_data: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
form_data: Optional[dict[str, Any]] = None,
) -> dict[str, Any]:
form_data = form_data or {}
table_name = query_name.split(":")[0]
table = self.get_table(table_name, table_id, table_type)