mirror of
https://github.com/apache/superset.git
synced 2026-05-06 16:34:32 +00:00
chore(pre-commit): Add pyupgrade and pycln hooks (#24197)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
# under the License.
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, Optional, TYPE_CHECKING
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
from superset.common.chart_data import ChartDataResultType
|
||||
from superset.common.query_object import QueryObject
|
||||
@@ -31,13 +31,13 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class QueryObjectFactory: # pylint: disable=too-few-public-methods
|
||||
_config: Dict[str, Any]
|
||||
_config: dict[str, Any]
|
||||
_datasource_dao: DatasourceDAO
|
||||
_session_maker: sessionmaker
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
app_configurations: Dict[str, Any],
|
||||
app_configurations: dict[str, Any],
|
||||
_datasource_dao: DatasourceDAO,
|
||||
session_maker: sessionmaker,
|
||||
):
|
||||
@@ -48,11 +48,11 @@ class QueryObjectFactory: # pylint: disable=too-few-public-methods
|
||||
def create( # pylint: disable=too-many-arguments
|
||||
self,
|
||||
parent_result_type: ChartDataResultType,
|
||||
datasource: Optional[DatasourceDict] = None,
|
||||
extras: Optional[Dict[str, Any]] = None,
|
||||
row_limit: Optional[int] = None,
|
||||
time_range: Optional[str] = None,
|
||||
time_shift: Optional[str] = None,
|
||||
datasource: DatasourceDict | None = None,
|
||||
extras: dict[str, Any] | None = None,
|
||||
row_limit: int | None = None,
|
||||
time_range: str | None = None,
|
||||
time_shift: str | None = None,
|
||||
**kwargs: Any,
|
||||
) -> QueryObject:
|
||||
datasource_model_instance = None
|
||||
@@ -84,13 +84,13 @@ class QueryObjectFactory: # pylint: disable=too-few-public-methods
|
||||
|
||||
def _process_extras( # pylint: disable=no-self-use
|
||||
self,
|
||||
extras: Optional[Dict[str, Any]],
|
||||
) -> Dict[str, Any]:
|
||||
extras: dict[str, Any] | None,
|
||||
) -> dict[str, Any]:
|
||||
extras = extras or {}
|
||||
return extras
|
||||
|
||||
def _process_row_limit(
|
||||
self, row_limit: Optional[int], result_type: ChartDataResultType
|
||||
self, row_limit: int | None, result_type: ChartDataResultType
|
||||
) -> int:
|
||||
default_row_limit = (
|
||||
self._config["SAMPLES_ROW_LIMIT"]
|
||||
|
||||
Reference in New Issue
Block a user