From ae05f9d0f37400bb41f1f7b387e128dd04cd2fc2 Mon Sep 17 00:00:00 2001 From: laughingman7743 Date: Sat, 6 Jan 2024 23:56:10 +0900 Subject: [PATCH] Remove python2 syntax --- README.rst | 4 ++-- pyathena/arrow/async_cursor.py | 2 +- pyathena/arrow/converter.py | 4 ++-- pyathena/arrow/cursor.py | 2 +- pyathena/arrow/result_set.py | 4 ++-- pyathena/async_cursor.py | 4 ++-- pyathena/common.py | 4 ++-- pyathena/converter.py | 4 +--- pyathena/cursor.py | 4 ++-- pyathena/filesystem/s3.py | 6 +++--- pyathena/formatter.py | 4 +--- pyathena/pandas/async_cursor.py | 2 +- pyathena/pandas/converter.py | 4 ++-- pyathena/pandas/cursor.py | 2 +- pyathena/pandas/result_set.py | 4 ++-- pyathena/result_set.py | 4 ++-- pyathena/sqlalchemy/base.py | 4 ++-- 17 files changed, 29 insertions(+), 33 deletions(-) diff --git a/README.rst b/README.rst index c67d9181..0a5d1f88 100644 --- a/README.rst +++ b/README.rst @@ -940,7 +940,7 @@ If you want to customize the pandas.Dataframe object dtypes and converters, crea class CustomPandasTypeConverter(Converter): def __init__(self): - super(CustomPandasTypeConverter, self).__init__( + super().__init__( mappings=None, types={ "boolean": object, @@ -1452,7 +1452,7 @@ If you want to customize the `pyarrow.Table object`_ types, create a converter c class CustomArrowTypeConverter(Converter): def __init__(self) -> None: - super(CustomArrowTypeConverter, self).__init__( + super().__init__( mappings={ "date": _to_date, }, diff --git a/pyathena/arrow/async_cursor.py b/pyathena/arrow/async_cursor.py index ff09598d..4b58a1e8 100644 --- a/pyathena/arrow/async_cursor.py +++ b/pyathena/arrow/async_cursor.py @@ -46,7 +46,7 @@ def __init__( result_reuse_enable: bool = False, result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, ) -> None: - super(AsyncArrowCursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, diff --git a/pyathena/arrow/converter.py b/pyathena/arrow/converter.py index 49e7b8c4..fa22633c 100644 --- a/pyathena/arrow/converter.py +++ b/pyathena/arrow/converter.py @@ -39,7 +39,7 @@ def _to_date(value: Optional[Union[str, datetime]]) -> Optional[date]: class DefaultArrowTypeConverter(Converter): def __init__(self) -> None: - super(DefaultArrowTypeConverter, self).__init__( + super().__init__( mappings=deepcopy(_DEFAULT_ARROW_CONVERTERS), default=_to_default, types=self._dtypes, @@ -81,7 +81,7 @@ def convert(self, type_: str, value: Optional[str]) -> Optional[Any]: class DefaultArrowUnloadTypeConverter(Converter): def __init__(self) -> None: - super(DefaultArrowUnloadTypeConverter, self).__init__( + super().__init__( mappings=dict(), default=_to_default, ) diff --git a/pyathena/arrow/cursor.py b/pyathena/arrow/cursor.py index 46cdb8c6..fbe2c26f 100644 --- a/pyathena/arrow/cursor.py +++ b/pyathena/arrow/cursor.py @@ -45,7 +45,7 @@ def __init__( result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, **kwargs, ) -> None: - super(ArrowCursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, diff --git a/pyathena/arrow/result_set.py b/pyathena/arrow/result_set.py index 5141802b..50086039 100644 --- a/pyathena/arrow/result_set.py +++ b/pyathena/arrow/result_set.py @@ -61,7 +61,7 @@ def __init__( unload_location: Optional[str] = None, **kwargs, ) -> None: - super(AthenaArrowResultSet, self).__init__( + super().__init__( connection=connection, converter=converter, query_execution=query_execution, @@ -284,6 +284,6 @@ def as_arrow(self) -> "Table": def close(self) -> None: import pyarrow as pa - super(AthenaArrowResultSet, self).close() + super().close() self._table = pa.Table.from_pydict(dict()) self._batches = [] diff --git a/pyathena/async_cursor.py b/pyathena/async_cursor.py index 4d7b3ec7..76771ec7 100644 --- a/pyathena/async_cursor.py +++ b/pyathena/async_cursor.py @@ -42,7 +42,7 @@ def __init__( result_reuse_enable: bool = False, result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, ) -> None: - super(AsyncCursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, @@ -140,7 +140,7 @@ def cancel(self, query_id: str) -> "Future[None]": class AsyncDictCursor(AsyncCursor): def __init__(self, **kwargs) -> None: - super(AsyncDictCursor, self).__init__(**kwargs) + super().__init__(**kwargs) self._result_set_class = AthenaDictResultSet if "dict_type" in kwargs: AthenaDictResultSet.dict_type = kwargs["dict_type"] diff --git a/pyathena/common.py b/pyathena/common.py index 43321161..7beadf71 100644 --- a/pyathena/common.py +++ b/pyathena/common.py @@ -30,7 +30,7 @@ class CursorIterator(metaclass=ABCMeta): DEFAULT_RESULT_REUSE_MINUTES = 60 def __init__(self, **kwargs) -> None: - super(CursorIterator, self).__init__() + super().__init__() self.arraysize: int = kwargs.get("arraysize", self.DEFAULT_FETCH_SIZE) self._rownumber: Optional[int] = None self._rowcount: int = -1 # By default, return -1 to indicate that this is not supported. @@ -107,7 +107,7 @@ def __init__( result_reuse_minutes: int, **kwargs, ) -> None: - super(BaseCursor, self).__init__() + super().__init__() self._connection = connection self._converter = converter self._formatter = formatter diff --git a/pyathena/converter.py b/pyathena/converter.py index 96274be2..38ba3f72 100644 --- a/pyathena/converter.py +++ b/pyathena/converter.py @@ -141,9 +141,7 @@ def convert(self, type_: str, value: Optional[str]) -> Optional[Any]: class DefaultTypeConverter(Converter): def __init__(self) -> None: - super(DefaultTypeConverter, self).__init__( - mappings=deepcopy(_DEFAULT_CONVERTERS), default=_to_default - ) + super().__init__(mappings=deepcopy(_DEFAULT_CONVERTERS), default=_to_default) def convert(self, type_: str, value: Optional[str]) -> Optional[Any]: converter = self.get(type_) diff --git a/pyathena/cursor.py b/pyathena/cursor.py index 5fcd3c2f..59274dc4 100644 --- a/pyathena/cursor.py +++ b/pyathena/cursor.py @@ -37,7 +37,7 @@ def __init__( result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, **kwargs, ) -> None: - super(Cursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, @@ -161,7 +161,7 @@ def fetchall( class DictCursor(Cursor): def __init__(self, **kwargs) -> None: - super(DictCursor, self).__init__(**kwargs) + super().__init__(**kwargs) self._result_set_class = AthenaDictResultSet if "dict_type" in kwargs: AthenaDictResultSet.dict_type = kwargs["dict_type"] diff --git a/pyathena/filesystem/s3.py b/pyathena/filesystem/s3.py index 57d8fdd0..927a4975 100644 --- a/pyathena/filesystem/s3.py +++ b/pyathena/filesystem/s3.py @@ -45,7 +45,7 @@ def __init__( *args, **kwargs, ) -> None: - super(S3FileSystem, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if connection: self._client = connection.session.client( "s3", @@ -483,7 +483,7 @@ def __init__( cache_options: Optional[Dict[Any, Any]] = None, size: Optional[int] = None, ): - super(S3File, self).__init__( + super().__init__( fs=fs, path=path, mode=mode, @@ -517,7 +517,7 @@ def __init__( self.request_kwargs = {"IfMatch": self.details["etag"]} def close(self): - super(S3File, self).close() + super().close() self._executor.shutdown() def _initiate_upload(self): diff --git a/pyathena/formatter.py b/pyathena/formatter.py index 5f20f812..93829e7a 100644 --- a/pyathena/formatter.py +++ b/pyathena/formatter.py @@ -172,9 +172,7 @@ def _format_decimal(formatter: Formatter, escaper: Callable[[str], str], val: An class DefaultParameterFormatter(Formatter): def __init__(self) -> None: - super(DefaultParameterFormatter, self).__init__( - mappings=deepcopy(_DEFAULT_FORMATTERS), default=None - ) + super().__init__(mappings=deepcopy(_DEFAULT_FORMATTERS), default=None) def format(self, operation: str, parameters: Optional[Dict[str, Any]] = None) -> str: if not operation or not operation.strip(): diff --git a/pyathena/pandas/async_cursor.py b/pyathena/pandas/async_cursor.py index 547dfc17..1af59eb9 100644 --- a/pyathena/pandas/async_cursor.py +++ b/pyathena/pandas/async_cursor.py @@ -48,7 +48,7 @@ def __init__( result_reuse_enable: bool = False, result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, ) -> None: - super(AsyncPandasCursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, diff --git a/pyathena/pandas/converter.py b/pyathena/pandas/converter.py index 030d10a0..b1e7f938 100644 --- a/pyathena/pandas/converter.py +++ b/pyathena/pandas/converter.py @@ -27,7 +27,7 @@ class DefaultPandasTypeConverter(Converter): def __init__(self) -> None: - super(DefaultPandasTypeConverter, self).__init__( + super().__init__( mappings=deepcopy(_DEFAULT_PANDAS_CONVERTERS), default=_to_default, types=self._dtypes, @@ -61,7 +61,7 @@ def convert(self, type_: str, value: Optional[str]) -> Optional[Any]: class DefaultPandasUnloadTypeConverter(Converter): def __init__(self) -> None: - super(DefaultPandasUnloadTypeConverter, self).__init__( + super().__init__( mappings=dict(), default=_to_default, ) diff --git a/pyathena/pandas/cursor.py b/pyathena/pandas/cursor.py index 819f3d2a..a326b89e 100644 --- a/pyathena/pandas/cursor.py +++ b/pyathena/pandas/cursor.py @@ -62,7 +62,7 @@ def __init__( result_reuse_minutes: int = CursorIterator.DEFAULT_RESULT_REUSE_MINUTES, **kwargs, ) -> None: - super(PandasCursor, self).__init__( + super().__init__( connection=connection, converter=converter, formatter=formatter, diff --git a/pyathena/pandas/result_set.py b/pyathena/pandas/result_set.py index ce8c31d7..4b8530aa 100644 --- a/pyathena/pandas/result_set.py +++ b/pyathena/pandas/result_set.py @@ -117,7 +117,7 @@ def __init__( max_workers: int = (cpu_count() or 1) * 5, **kwargs, ) -> None: - super(AthenaPandasResultSet, self).__init__( + super().__init__( connection=connection, converter=converter, query_execution=query_execution, @@ -398,7 +398,7 @@ def as_pandas(self) -> Union[DataFrameIterator, "DataFrame"]: def close(self) -> None: import pandas as pd - super(AthenaPandasResultSet, self).close() + super().close() self._df_iter = DataFrameIterator(pd.DataFrame(), _no_trunc_date) self._iterrows = enumerate([]) self._data_manifest = [] diff --git a/pyathena/result_set.py b/pyathena/result_set.py index b14347a5..4348d062 100644 --- a/pyathena/result_set.py +++ b/pyathena/result_set.py @@ -39,7 +39,7 @@ def __init__( arraysize: int, retry_config: RetryConfig, ) -> None: - super(AthenaResultSet, self).__init__(arraysize=arraysize) + super().__init__(arraysize=arraysize) self._connection: Optional["Connection"] = connection self._converter = converter self._query_execution: Optional[AthenaQueryExecution] = query_execution @@ -508,7 +508,7 @@ def _get_rows( class WithResultSet: def __init__(self): - super(WithResultSet, self).__init__() + super().__init__() def _reset_state(self) -> None: self.query_id = None # type: ignore diff --git a/pyathena/sqlalchemy/base.py b/pyathena/sqlalchemy/base.py index 9b717fda..cda89e65 100644 --- a/pyathena/sqlalchemy/base.py +++ b/pyathena/sqlalchemy/base.py @@ -395,7 +395,7 @@ def __init__( quote_case_sensitive_collations: bool = True, omit_schema: bool = False, ): - super(AthenaDDLIdentifierPreparer, self).__init__( + super().__init__( dialect=dialect, initial_quote=initial_quote, final_quote=final_quote, @@ -538,7 +538,7 @@ def __init__( compile_kwargs: Mapping[str, Any] = util.immutabledict(), ): self._preparer = AthenaDDLIdentifierPreparer(dialect) - super(AthenaDDLCompiler, self).__init__( + super().__init__( dialect=dialect, statement=statement, render_schema_translate=render_schema_translate,