Skip to content

Commit

Permalink
Merge pull request #487 from yt-project/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
neutrinoceros authored Feb 6, 2024
2 parents cb71e02 + ddda3d2 commit 8bf4487
Show file tree
Hide file tree
Showing 24 changed files with 15 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ repos:
- id: check-toml

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.9.1]
additional_dependencies: [black==24.1.1]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: [--fix]
args: [--fix, --show-fixes]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ exclude = [
"*/_version.py",
"*/__init__.py",
]
[tool.ruff.lint]
ignore = [
"E501",
"B904",
Expand All @@ -110,7 +111,7 @@ select = [
"NPY", # numpy specific rules
]

[tool.ruff.isort]
[tool.ruff.lint.isort]
combine-as-imports = true

[tool.setuptools_scm]
Expand Down
1 change: 0 additions & 1 deletion unyt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* :func:`unyt.dimensions.returns`
"""


from unyt import physical_constants, unit_symbols
from unyt.array import ( # NOQA: F401
allclose_units,
Expand Down
5 changes: 3 additions & 2 deletions unyt/_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,10 +956,11 @@ def array_repr(arr, *args, **kwargs):

if NUMPY_VERSION < Version("2.0.0dev0"):
# functions that are removed in numpy 2.0.0
@implements(np.asfarray)
@implements(np.asfarray) # noqa: NPY201
def asfarray(a, dtype=np.double):
ret_units = a.units
return np.asfarray._implementation(np.asarray(a), dtype=dtype) * ret_units
arr = np.asfarray._implementation(np.asarray(a), dtype=dtype) # noqa: NPY201
return arr * ret_units

elif NUMPY_VERSION >= Version("2.0.0dev0"):
# functions that were added in numpy 2.0.0
Expand Down
1 change: 0 additions & 1 deletion unyt/_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""


import token

from sympy import Basic, Float, Integer, Rational, Symbol, sqrt
Expand Down
1 change: 0 additions & 1 deletion unyt/_pint_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


pint_aliases = {
"meter": "m",
"second": "s",
Expand Down
1 change: 0 additions & 1 deletion unyt/_unit_lookup_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""


from collections import OrderedDict, defaultdict

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion unyt/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""


import copy
import re
import sys
Expand Down
1 change: 0 additions & 1 deletion unyt/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""


from functools import wraps
from itertools import chain

Expand Down
1 change: 0 additions & 1 deletion unyt/equivalencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


from collections import OrderedDict

import numpy as np
Expand Down
1 change: 0 additions & 1 deletion unyt/mpl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
manager.
"""


from unyt.array import unyt_array, unyt_quantity

from ._on_demand_imports import _matplotlib
Expand Down
1 change: 0 additions & 1 deletion unyt/physical_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""


from unyt.unit_registry import default_unit_registry as _default_unit_registry
from unyt.unit_systems import add_constants as _add_constants

Expand Down
1 change: 0 additions & 1 deletion unyt/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


import warnings

from unyt.array import NULL_UNIT, allclose_units
Expand Down
2 changes: 1 addition & 1 deletion unyt/tests/test_array_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def test_append_inconsistent_units():
def test_asfarray():
x1 = np.eye(3, dtype="int64") * cm

x2 = np.asfarray(x1)
x2 = np.asfarray(x1) # noqa: NPY201
assert type(x2) is unyt_array
assert x2.units == cm
assert x2.dtype == "float64"
Expand Down
1 change: 1 addition & 0 deletions unyt/tests/test_mpl_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Matplotlib ConversionInterface"""

import numpy as np
import pytest

Expand Down
1 change: 0 additions & 1 deletion unyt/tests/test_unit_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""


import os

import pytest
Expand Down
1 change: 0 additions & 1 deletion unyt/tests/test_unit_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


import pytest

import unyt.unit_symbols as us
Expand Down
9 changes: 2 additions & 7 deletions unyt/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""


import operator
import pickle

Expand Down Expand Up @@ -395,9 +394,7 @@ def test_power():
u3 = u1 ** (-1.0 / 3)

assert u3.dimensions == nsimplify(u1_dims ** (-1.0 / 3))
assert_allclose_units(
u3.base_value, (pc_mks**2 * mK_mks**4) ** (-1.0 / 3), 1e-12
)
assert_allclose_units(u3.base_value, (pc_mks**2 * mK_mks**4) ** (-1.0 / 3), 1e-12)

assert u1**0.0 == dimensionless

Expand Down Expand Up @@ -480,9 +477,7 @@ def test_base_equivalent():
assert u2.dimensions == mass_density
assert u3.dimensions == mass_density

assert_allclose_units(
u1.get_conversion_factor(u3)[0], Msun_mks / Mpc_mks**3, 1e-12
)
assert_allclose_units(u1.get_conversion_factor(u3)[0], Msun_mks / Mpc_mks**3, 1e-12)

with pytest.raises(UnitConversionError):
u1.get_conversion_factor(Unit("m"))
Expand Down
1 change: 1 addition & 0 deletions unyt/tests/test_unyt_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import copy
import itertools
import math
Expand Down
1 change: 1 addition & 0 deletions unyt/tests/test_unyt_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Test unyt.testing module that contains utilities for writing tests.
"""

import pytest

from unyt import accepts, meter, returns, second
Expand Down
1 change: 0 additions & 1 deletion unyt/unit_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""


import copy
import itertools
import math
Expand Down
1 change: 0 additions & 1 deletion unyt/unit_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""


import copy
import json
from functools import lru_cache
Expand Down
1 change: 0 additions & 1 deletion unyt/unit_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"""


from unyt._unit_lookup_table import name_alternatives as _name_alternatives
from unyt.unit_object import Unit as _Unit
from unyt.unit_registry import default_unit_registry as _registry
Expand Down
1 change: 0 additions & 1 deletion unyt/unit_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""


from collections import OrderedDict

from unyt import dimensions
Expand Down

0 comments on commit 8bf4487

Please sign in to comment.