Skip to content

Commit

Permalink
chore: update pre-commit hooks (#3319)
Browse files Browse the repository at this point in the history
* chore: update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.4 → v0.8.0](astral-sh/ruff-pre-commit@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>
  • Loading branch information
pre-commit-ci[bot] authored Nov 26, 2024
1 parent 4eebc08 commit fcc0acc
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion dev/generate-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/awkward/_connect/pyarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
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",
"to_awkwardarrow_type",
"to_length",
"to_null_count",
"to_validbits",
"convert_awkward_arrow_table_to_native",
"convert_native_arrow_table_to_awkward",
]

try:
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/awkward/_nplikes/ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@
)

__all__ = [
"bitwise_not",
"matmul",
"abs",
"absolute",
"add",
"arccos",
Expand All @@ -110,6 +109,7 @@
"arctan2",
"arctanh",
"bitwise_and",
"bitwise_not",
"bitwise_or",
"bitwise_xor",
"cbrt",
Expand All @@ -128,9 +128,9 @@
"exp2",
"expm1",
"fabs",
"float_power",
"floor",
"floor_divide",
"float_power",
"fmax",
"fmin",
"fmod",
Expand All @@ -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",
Expand Down Expand Up @@ -188,6 +189,5 @@
"tanh",
"true_divide",
"trunc",
"abs",
"ufunc",
]
2 changes: 1 addition & 1 deletion src/awkward/_typetracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from awkward._nplikes.typetracer import MaybeNone, OneOf # noqa: F401

__all__ = ["UnknownScalar", "UnknownLength"]
__all__ = ["UnknownLength", "UnknownScalar"]


UnknownLength = None
Expand Down
25 changes: 14 additions & 11 deletions src/awkward/contents/numpyarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
)
)
)

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy

__all__ = ("FieldNotFoundError", "AxisError")
__all__ = ("AxisError", "FieldNotFoundError")


class FieldNotFoundError(IndexError):
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/forms/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 2 additions & 5 deletions src/awkward/operations/ak_drop_none.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_std.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/awkward/operations/ak_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
14 changes: 7 additions & 7 deletions src/awkward/typetracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]


Expand Down

0 comments on commit fcc0acc

Please sign in to comment.