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

@@ -17,7 +17,7 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Dict, Optional, TYPE_CHECKING
from typing import TYPE_CHECKING
from pandas import DataFrame
from sqlalchemy.inspection import inspect
@@ -63,10 +63,10 @@ class PandasDataLoader(DataLoader):
schema=self._detect_schema_name(),
)
def _detect_schema_name(self) -> Optional[str]:
def _detect_schema_name(self) -> str | None:
return inspect(self._db_engine).default_schema_name
def _take_data_types(self, table: Table) -> Optional[Dict[str, str]]:
def _take_data_types(self, table: Table) -> dict[str, str] | None:
if metadata_table := table.table_metadata:
types = metadata_table.types
if types:

View File

@@ -16,7 +16,7 @@
# under the License.
from __future__ import annotations
from typing import Any, Dict
from typing import Any
default_pandas_data_loader_config = {
"if_exists": "replace",
@@ -54,7 +54,7 @@ class PandasLoaderConfigurations:
self.support_datetime_type = support_datetime_type
@classmethod
def make_from_dict(cls, _dict: Dict[str, Any]) -> PandasLoaderConfigurations:
def make_from_dict(cls, _dict: dict[str, Any]) -> PandasLoaderConfigurations:
copy_dict = default_pandas_data_loader_config.copy()
copy_dict.update(_dict)
return PandasLoaderConfigurations(**copy_dict) # type: ignore

View File

@@ -16,7 +16,7 @@
# under the License.
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING
from pandas import DataFrame
@@ -30,10 +30,10 @@ if TYPE_CHECKING:
@log
class TableToDfConvertorImpl(TableToDfConvertor):
convert_datetime_to_str: bool
_time_format: Optional[str]
_time_format: str | None
def __init__(
self, convert_ds_to_datetime: bool, time_format: Optional[str] = None
self, convert_ds_to_datetime: bool, time_format: str | None = None
) -> None:
self.convert_datetime_to_str = convert_ds_to_datetime
self._time_format = time_format