Skip to content

Commit

Permalink
Merge branch 'master' into #493
Browse files Browse the repository at this point in the history
  • Loading branch information
laughingman7743 authored Jan 6, 2024
2 parents 0187752 + 8267e99 commit 60f287d
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 35 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion pyathena/arrow/async_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(
unload: bool = False,
**kwargs,
) -> None:
super(AsyncArrowCursor, self).__init__(
super().__init__(
max_workers=max_workers,
arraysize=arraysize,
**kwargs,
Expand Down
4 changes: 2 additions & 2 deletions pyathena/arrow/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion pyathena/arrow/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(
unload: bool = False,
**kwargs,
) -> None:
super(ArrowCursor, self).__init__(**kwargs)
super().__init__(**kwargs)
self._unload = unload
self._query_id: Optional[str] = None
self._result_set: Optional[AthenaArrowResultSet] = None
Expand Down
4 changes: 2 additions & 2 deletions pyathena/arrow/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = []
4 changes: 2 additions & 2 deletions pyathena/async_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
arraysize: int = CursorIterator.DEFAULT_FETCH_SIZE,
**kwargs,
) -> None:
super(AsyncCursor, self).__init__(**kwargs)
super().__init__(**kwargs)
self._max_workers = max_workers
self._executor = ThreadPoolExecutor(max_workers=max_workers)
self._arraysize = arraysize
Expand Down Expand Up @@ -107,7 +107,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"]
4 changes: 2 additions & 2 deletions pyathena/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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.
Expand Down Expand Up @@ -113,7 +113,7 @@ def __init__(
result_reuse_minutes: int,
**kwargs,
) -> None:
super(BaseCursor, self).__init__()
super().__init__()
self._connection = connection
self._converter = converter
self._formatter = formatter
Expand Down
4 changes: 1 addition & 3 deletions pyathena/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
4 changes: 2 additions & 2 deletions pyathena/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class Cursor(BaseCursor, CursorIterator, WithResultSet):
def __init__(self, **kwargs) -> None:
super(Cursor, self).__init__(**kwargs)
super().__init__(**kwargs)
self._query_id: Optional[str] = None
self._result_set: Optional[AthenaResultSet] = None
self._result_set_class = AthenaResultSet
Expand Down Expand Up @@ -123,7 +123,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"]
6 changes: 3 additions & 3 deletions pyathena/filesystem/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions pyathena/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 1 addition & 3 deletions pyathena/pandas/async_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def __init__(
chunksize: Optional[int] = None,
**kwargs,
) -> None:
super(AsyncPandasCursor, self).__init__(
max_workers=max_workers, arraysize=arraysize, **kwargs
)
super().__init__(max_workers=max_workers, arraysize=arraysize, **kwargs)
self._unload = unload
self._engine = engine
self._chunksize = chunksize
Expand Down
4 changes: 2 additions & 2 deletions pyathena/pandas/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion pyathena/pandas/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
max_workers: int = (cpu_count() or 1) * 5,
**kwargs,
) -> None:
super(PandasCursor, self).__init__(**kwargs)
super().__init__(**kwargs)
self._unload = unload
self._engine = engine
self._chunksize = chunksize
Expand Down
4 changes: 2 additions & 2 deletions pyathena/pandas/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = []
4 changes: 2 additions & 2 deletions pyathena/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -506,7 +506,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
Expand Down
4 changes: 2 additions & 2 deletions pyathena/sqlalchemy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 60f287d

Please sign in to comment.