Skip to content

Commit

Permalink
chore: update pre-commit hooks (#546)
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.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 13, 2025
1 parent 0183170 commit acee922
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ repos:
types: [file, python]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.6"
rev: "v0.9.1"
hooks:
# Run the linter
- id: ruff
Expand Down
6 changes: 2 additions & 4 deletions cf_units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1768,8 +1768,7 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False):
# Strict type check of numpy array.
if result.dtype.type not in (np.float32, np.float64):
raise TypeError(
"Expect a numpy array of "
f"'{np.float32}' or '{np.float64}'"
f"Expect a numpy array of '{np.float32}' or '{np.float64}'"
)
ctype = result.dtype.type
# Utilise global convenience dictionary
Expand All @@ -1788,8 +1787,7 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False):
else:
if ctype not in _cv_convert_scalar:
raise ValueError(
"Invalid target type. Can only "
"convert to float or double."
"Invalid target type. Can only convert to float or double."
)
# Utilise global convenience dictionary
# _cv_convert_scalar
Expand Down
6 changes: 3 additions & 3 deletions cf_units/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,18 @@ def test_python_versions():
ci_tests_file,
(
f"os: [ubuntu-latest]\n"
f"{8*' '}version: ["
f"{8 * ' '}version: ["
+ ", ".join([f"py{p}" for p in supported_strip])
+ "]"
),
),
(
ci_tests_file,
(f"os: ubuntu-latest\n{12*' '}version: py{supported_latest}"),
(f"os: ubuntu-latest\n{12 * ' '}version: py{supported_latest}"),
),
(
ci_tests_file,
(f"os: macos-latest\n{12*' '}version: py{supported_latest}"),
(f"os: macos-latest\n{12 * ' '}version: py{supported_latest}"),
),
]

Expand Down
3 changes: 1 addition & 2 deletions cf_units/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ def __new__(cls, name, bases, namespace):
if "__init__" not in namespace:
# Create a default __init__ method for the class
method_source = (
f"def __init__(self, {args}):\n "
f"self._init_from_tuple(({args},))"
f"def __init__(self, {args}):\n self._init_from_tuple(({args},))"
)
exec(method_source, namespace)

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def get_package_data():
xml_database = Path(xml_database)
if not xml_database.is_file():
emsg = (
f"Can't open {xml_env} file {xml_database} "
"during cf-units wheel build."
f"Can't open {xml_env} file {xml_database} during cf-units wheel build."
)
raise ValueError(emsg)
# We have a valid XML file, so copy the distro bundle into the
Expand Down

0 comments on commit acee922

Please sign in to comment.