From 77bfe1e1369cea218e6d64ff43d084ba1f7cc9d6 Mon Sep 17 00:00:00 2001 From: Pavel Zwerschke Date: Thu, 8 Aug 2024 18:20:29 +0200 Subject: [PATCH] pre-commit --- pyproject.toml | 12 +++--- src/pydiverse/transform/core/table_impl.py | 41 ++++++++------------- src/pydiverse/transform/core/util/bidict.py | 8 +--- 3 files changed, 24 insertions(+), 37 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a48ab8d1..0c495b42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,11 @@ pyarrow = [ packages = ["src/pydiverse"] [tool.ruff] +target-version = "py38" +extend-exclude = ["docs/*"] +fix = true + +[tool.ruff.lint] select = [ "F", "E", @@ -47,16 +52,13 @@ ignore = [ "A001", # Keep while filter verb still is called filter "A003", # Keep while filter verb still is called filter ] -extend-exclude = ["docs/*"] ignore-init-module-imports = true -fix = true -target-version = "py38" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403"] "tests/*" = ["F403", "F405", "E711"] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["pydiverse"] required-imports = ["from __future__ import annotations"] diff --git a/src/pydiverse/transform/core/table_impl.py b/src/pydiverse/transform/core/table_impl.py index eeee76c6..1e7164ce 100644 --- a/src/pydiverse/transform/core/table_impl.py +++ b/src/pydiverse/transform/core/table_impl.py @@ -175,41 +175,29 @@ def preverb_hook(self, verb: str, *args, **kwargs) -> None: """ ... - def alias(self, name=None) -> AbstractTableImpl: - ... + def alias(self, name=None) -> AbstractTableImpl: ... - def collect(self): - ... + def collect(self): ... - def build_query(self): - ... + def build_query(self): ... - def select(self, *args): - ... + def select(self, *args): ... - def mutate(self, **kwargs): - ... + def mutate(self, **kwargs): ... - def join(self, right, on, how, *, validate=None): - ... + def join(self, right, on, how, *, validate=None): ... - def filter(self, *args): - ... + def filter(self, *args): ... - def arrange(self, ordering: list[OrderingDescriptor]): - ... + def arrange(self, ordering: list[OrderingDescriptor]): ... - def group_by(self, *args): - ... + def group_by(self, *args): ... - def ungroup(self, *args): - ... + def ungroup(self, *args): ... - def summarise(self, **kwargs): - ... + def summarise(self, **kwargs): ... - def slice_head(self, n: int, offset: int): - ... + def slice_head(self, n: int, offset: int): ... #### Symbolic Operators #### @@ -292,8 +280,9 @@ def _translate_case_common( else: # AGGREGATE and EWISE are incompatible raise FunctionTypeError( - "Incompatible function types found in case statement: " - ", ".join(val_ftypes) + "Incompatible function types found in case statement: " ", ".join( + val_ftypes + ) ) if result_ftype is OPType.EWISE and switching_on is not None: diff --git a/src/pydiverse/transform/core/util/bidict.py b/src/pydiverse/transform/core/util/bidict.py index b64d13d4..59308976 100644 --- a/src/pydiverse/transform/core/util/bidict.py +++ b/src/pydiverse/transform/core/util/bidict.py @@ -40,12 +40,8 @@ def __init__(self, seq: Mapping[KT, VT] = None, /, *, fwd=None, bwd=None): " unique." ) - self.fwd = _BidictInterface( - self.__fwd, self.__bwd - ) # type: _BidictInterface[KT, VT] - self.bwd = _BidictInterface( - self.__bwd, self.__fwd - ) # type: _BidictInterface[VT, KT] + self.fwd = _BidictInterface(self.__fwd, self.__bwd) # type: _BidictInterface[KT, VT] + self.bwd = _BidictInterface(self.__bwd, self.__fwd) # type: _BidictInterface[VT, KT] def __copy__(self): return bidict(fwd=self.__fwd.copy(), bwd=self.__bwd.copy())