mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore(pre-commit): Add pyupgrade and pycln hooks (#24197)
This commit is contained in:
@@ -20,7 +20,7 @@ from __future__ import annotations
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Type, TYPE_CHECKING
|
||||
from typing import Any, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.engine.reflection import Inspector
|
||||
@@ -79,7 +79,7 @@ class DruidEngineSpec(BaseEngineSpec):
|
||||
orm_col.is_dttm = True
|
||||
|
||||
@staticmethod
|
||||
def get_extra_params(database: Database) -> Dict[str, Any]:
|
||||
def get_extra_params(database: Database) -> dict[str, Any]:
|
||||
"""
|
||||
For Druid, the path to a SSL certificate is placed in `connect_args`.
|
||||
|
||||
@@ -104,8 +104,8 @@ class DruidEngineSpec(BaseEngineSpec):
|
||||
|
||||
@classmethod
|
||||
def convert_dttm(
|
||||
cls, target_type: str, dttm: datetime, db_extra: Optional[Dict[str, Any]] = None
|
||||
) -> Optional[str]:
|
||||
cls, target_type: str, dttm: datetime, db_extra: dict[str, Any] | None = None
|
||||
) -> str | None:
|
||||
sqla_type = cls.get_sqla_column_type(target_type)
|
||||
|
||||
if isinstance(sqla_type, types.Date):
|
||||
@@ -130,15 +130,15 @@ class DruidEngineSpec(BaseEngineSpec):
|
||||
|
||||
@classmethod
|
||||
def get_columns(
|
||||
cls, inspector: Inspector, table_name: str, schema: Optional[str]
|
||||
) -> List[Dict[str, Any]]:
|
||||
cls, inspector: Inspector, table_name: str, schema: str | None
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Update the Druid type map.
|
||||
"""
|
||||
return super().get_columns(inspector, table_name, schema)
|
||||
|
||||
@classmethod
|
||||
def get_dbapi_exception_mapping(cls) -> Dict[Type[Exception], Type[Exception]]:
|
||||
def get_dbapi_exception_mapping(cls) -> dict[type[Exception], type[Exception]]:
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from requests import exceptions as requests_exceptions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user