From fcc0acc700f892023b44e25b28ede23c0593322e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:36:40 -0600 Subject: [PATCH] chore: update pre-commit hooks (#3319) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.4 → v0.8.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.4...v0.8.0) * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- dev/generate-tests.py | 2 +- src/awkward/_connect/pyarrow/__init__.py | 10 +++++----- src/awkward/_errors.py | 2 +- src/awkward/_nplikes/ufuncs.py | 10 +++++----- src/awkward/_typetracer.py | 2 +- src/awkward/contents/numpyarray.py | 25 +++++++++++++----------- src/awkward/errors.py | 2 +- src/awkward/forms/form.py | 2 +- src/awkward/operations/ak_drop_none.py | 7 ++----- src/awkward/operations/ak_prod.py | 2 +- src/awkward/operations/ak_std.py | 2 +- src/awkward/operations/ak_sum.py | 2 +- src/awkward/operations/ak_var.py | 2 +- src/awkward/typetracer.py | 14 ++++++------- 15 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3aeb83a0e8..2b4107de68 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: additional_dependencies: [pyyaml] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.4 + rev: v0.8.0 hooks: - id: ruff args: ["--fix", "--show-fixes"] diff --git a/dev/generate-tests.py b/dev/generate-tests.py index 1a1390eeb4..48c90b3a59 100644 --- a/dev/generate-tests.py +++ b/dev/generate-tests.py @@ -26,7 +26,7 @@ def reproducible_datetime(): class Argument: - __slots__ = ("name", "typename", "direction", "role") + __slots__ = ("direction", "name", "role", "typename") def __init__(self, name, typename, direction, role="default"): self.name = name diff --git a/src/awkward/_connect/pyarrow/__init__.py b/src/awkward/_connect/pyarrow/__init__.py index a5b04500c6..12835718b4 100644 --- a/src/awkward/_connect/pyarrow/__init__.py +++ b/src/awkward/_connect/pyarrow/__init__.py @@ -7,17 +7,19 @@ from packaging.version import parse as parse_version __all__ = [ - "import_pyarrow", - "import_pyarrow_parquet", - "import_pyarrow_compute", "AwkwardArrowArray", "AwkwardArrowType", "and_validbytes", + "convert_awkward_arrow_table_to_native", + "convert_native_arrow_table_to_awkward", "convert_to_array", "direct_Content_subclass", "direct_Content_subclass_name", "form_handle_arrow", "handle_arrow", + "import_pyarrow", + "import_pyarrow_compute", + "import_pyarrow_parquet", "popbuffers", "remove_optiontype", "to_awkwardarrow_storage_types", @@ -25,8 +27,6 @@ "to_length", "to_null_count", "to_validbits", - "convert_awkward_arrow_table_to_native", - "convert_native_arrow_table_to_awkward", ] try: diff --git a/src/awkward/_errors.py b/src/awkward/_errors.py index 0aebfc2a0e..a6efa8f04b 100644 --- a/src/awkward/_errors.py +++ b/src/awkward/_errors.py @@ -40,7 +40,7 @@ def __call__(self, *args, **kwargs): class PartialFunction: """Analogue of `functools.partial`, but as a distinct type""" - __slots__ = ("func", "args", "kwargs") + __slots__ = ("args", "func", "kwargs") def __init__(self, func, *args, **kwargs): self.func = func diff --git a/src/awkward/_nplikes/ufuncs.py b/src/awkward/_nplikes/ufuncs.py index ce98f0b613..8d2425e0bc 100644 --- a/src/awkward/_nplikes/ufuncs.py +++ b/src/awkward/_nplikes/ufuncs.py @@ -98,8 +98,7 @@ ) __all__ = [ - "bitwise_not", - "matmul", + "abs", "absolute", "add", "arccos", @@ -110,6 +109,7 @@ "arctan2", "arctanh", "bitwise_and", + "bitwise_not", "bitwise_or", "bitwise_xor", "cbrt", @@ -128,9 +128,9 @@ "exp2", "expm1", "fabs", + "float_power", "floor", "floor_divide", - "float_power", "fmax", "fmin", "fmod", @@ -151,15 +151,16 @@ "less", "less_equal", "log", - "log10", "log1p", "log2", + "log10", "logaddexp", "logaddexp2", "logical_and", "logical_not", "logical_or", "logical_xor", + "matmul", "maximum", "minimum", "mod", @@ -188,6 +189,5 @@ "tanh", "true_divide", "trunc", - "abs", "ufunc", ] diff --git a/src/awkward/_typetracer.py b/src/awkward/_typetracer.py index 7e8701c38a..91b5954669 100644 --- a/src/awkward/_typetracer.py +++ b/src/awkward/_typetracer.py @@ -8,7 +8,7 @@ from awkward._nplikes.typetracer import MaybeNone, OneOf # noqa: F401 -__all__ = ["UnknownScalar", "UnknownLength"] +__all__ = ["UnknownLength", "UnknownScalar"] UnknownLength = None diff --git a/src/awkward/contents/numpyarray.py b/src/awkward/contents/numpyarray.py index 3b07810b40..ac870e883e 100644 --- a/src/awkward/contents/numpyarray.py +++ b/src/awkward/contents/numpyarray.py @@ -484,7 +484,8 @@ def _mergeable_next(self, other: Content, mergebool: bool) -> bool: elif ( np.issubdtype(self.dtype, np.bool_) and np.issubdtype(other.dtype, np.number) - or np.issubdtype(self.dtype, np.number) + ) or ( + np.issubdtype(self.dtype, np.number) and np.issubdtype(other.dtype, np.bool_) ): return mergebool @@ -1382,16 +1383,18 @@ def _is_equal_to( return self._is_equal_to_generic(other, all_parameters) and ( not numpyarray # dtypes agree - or self.dtype == other.dtype - # Contents agree - and ( - not self._backend.nplike.known_data - or self._backend.nplike.array_equal(self.data, other.data) - ) - # Shapes agree - and all( - x is unknown_length or y is unknown_length or x == y - for x, y in zip(self.shape, other.shape) + or ( + self.dtype == other.dtype + # Contents agree + and ( + not self._backend.nplike.known_data + or self._backend.nplike.array_equal(self.data, other.data) + ) + # Shapes agree + and all( + x is unknown_length or y is unknown_length or x == y + for x, y in zip(self.shape, other.shape) + ) ) ) diff --git a/src/awkward/errors.py b/src/awkward/errors.py index fb559bf468..fd201eca37 100644 --- a/src/awkward/errors.py +++ b/src/awkward/errors.py @@ -4,7 +4,7 @@ import numpy -__all__ = ("FieldNotFoundError", "AxisError") +__all__ = ("AxisError", "FieldNotFoundError") class FieldNotFoundError(IndexError): diff --git a/src/awkward/forms/form.py b/src/awkward/forms/form.py index 5ebee62b83..ef7019bf68 100644 --- a/src/awkward/forms/form.py +++ b/src/awkward/forms/form.py @@ -32,7 +32,7 @@ Union, ) -__all__ = ("from_dict", "from_type", "from_json", "reserved_nominal_parameters", "Form") +__all__ = ("Form", "from_dict", "from_json", "from_type", "reserved_nominal_parameters") np = NumpyMetadata.instance() numpy_backend = NumpyBackend.instance() diff --git a/src/awkward/operations/ak_drop_none.py b/src/awkward/operations/ak_drop_none.py index d81770f78f..dc336a8f58 100644 --- a/src/awkward/operations/ak_drop_none.py +++ b/src/awkward/operations/ak_drop_none.py @@ -94,11 +94,8 @@ def action(layout, continuation, **kwargs): def recompute_offsets(layout, depth, **kwargs): posaxis = maybe_posaxis(layout, axis, depth) - if ( - posaxis == 0 - and posaxis == depth - 1 - or posaxis == depth - and layout.is_list + if (posaxis == 0 and posaxis == depth - 1) or ( + posaxis == depth and layout.is_list ): none_indexes = options["none_indexes"].pop(0) out = layout._rebuild_without_nones(none_indexes, layout.content) diff --git a/src/awkward/operations/ak_prod.py b/src/awkward/operations/ak_prod.py index d3d1a050c3..ce38ad72a1 100644 --- a/src/awkward/operations/ak_prod.py +++ b/src/awkward/operations/ak_prod.py @@ -15,7 +15,7 @@ from awkward._nplikes.numpy_like import NumpyMetadata from awkward._regularize import regularize_axis -__all__ = ("prod", "nanprod") +__all__ = ("nanprod", "prod") np = NumpyMetadata.instance() diff --git a/src/awkward/operations/ak_std.py b/src/awkward/operations/ak_std.py index 9343e0f1ce..edb101a48f 100644 --- a/src/awkward/operations/ak_std.py +++ b/src/awkward/operations/ak_std.py @@ -20,7 +20,7 @@ from awkward._nplikes.numpy_like import NumpyMetadata from awkward._regularize import regularize_axis -__all__ = ("std", "nanstd") +__all__ = ("nanstd", "std") np = NumpyMetadata.instance() diff --git a/src/awkward/operations/ak_sum.py b/src/awkward/operations/ak_sum.py index ae6a40aef8..bb42df62d2 100644 --- a/src/awkward/operations/ak_sum.py +++ b/src/awkward/operations/ak_sum.py @@ -15,7 +15,7 @@ from awkward._nplikes.numpy_like import NumpyMetadata from awkward._regularize import regularize_axis -__all__ = ("sum", "nansum") +__all__ = ("nansum", "sum") np = NumpyMetadata.instance() diff --git a/src/awkward/operations/ak_var.py b/src/awkward/operations/ak_var.py index 61139181cb..e66275359c 100644 --- a/src/awkward/operations/ak_var.py +++ b/src/awkward/operations/ak_var.py @@ -19,7 +19,7 @@ from awkward._nplikes.numpy_like import NumpyMetadata from awkward._regularize import regularize_axis -__all__ = ("var", "nanvar") +__all__ = ("nanvar", "var") np = NumpyMetadata.instance() diff --git a/src/awkward/typetracer.py b/src/awkward/typetracer.py index 14af0739ca..3fc98ade9e 100644 --- a/src/awkward/typetracer.py +++ b/src/awkward/typetracer.py @@ -33,17 +33,17 @@ from numpy.typing import DTypeLike # noqa: TID251 __all__ = [ + "MaybeNone", + "OneOf", + "PlaceholderArray", + "TypeTracerArray", + "TypeTracerReport", + "create_unknown_scalar", "is_unknown_array", "is_unknown_scalar", - "TypeTracerReport", + "touch_data", "typetracer_with_report", - "PlaceholderArray", "unknown_length", - "touch_data", - "TypeTracerArray", - "MaybeNone", - "OneOf", - "create_unknown_scalar", ]