Skip to content

Commit

Permalink
Merge pull request #4863 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 Apr 1, 2024
2 parents 688167c + bdf5d5a commit fca7a77
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: check-yaml

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.3.0
hooks:
- id: black-jupyter

Expand All @@ -39,7 +39,7 @@ repos:
additional_dependencies: [black==23.9.1]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.4
hooks:
- id: ruff
args: [--fix, "--show-fixes"]
Expand Down
5 changes: 2 additions & 3 deletions yt/data_objects/data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1424,9 +1424,8 @@ def __repr__(self):
s = f"{self.__class__.__name__} ({self.ds}): "
for i in self._con_args:
try:
s += ", {}={}".format(
i,
getattr(self, i).in_base(unit_system=self.ds.unit_system),
s += (
f", {i}={getattr(self, i).in_base(unit_system=self.ds.unit_system)}"
)
except AttributeError:
s += f", {i}={getattr(self, i)}"
Expand Down
4 changes: 1 addition & 3 deletions yt/data_objects/index_subobjects/octree_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ def deposit(self, positions, fields=None, method=None, kernel_name="cubic"):
nvals = (nz, nz, nz, (self.domain_ind >= 0).sum())
if np.max(self.domain_ind) >= nvals[-1]:
print(
"nocts, domain_ind >= 0, max {} {} {}".format(
self.oct_handler.nocts, nvals[-1], np.max(self.domain_ind)
)
f"nocts, domain_ind >= 0, max {self.oct_handler.nocts} {nvals[-1]} {np.max(self.domain_ind)}"
)
raise Exception()
# We allocate number of zones, not number of octs
Expand Down
4 changes: 1 addition & 3 deletions yt/data_objects/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,9 +1388,7 @@ def create_profile(
field_ex = list(extrema[bin_field])
except KeyError:
raise RuntimeError(
"Could not find field {} or {} in extrema".format(
bin_field[-1], bin_field
)
f"Could not find field {bin_field[-1]} or {bin_field} in extrema"
) from e

if isinstance(field_ex[0], tuple):
Expand Down
6 changes: 2 additions & 4 deletions yt/data_objects/static_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,8 @@ def set_field_label_format(self, format_property, value):
setattr(self, f"_{format_property}_format", value)
else:
raise ValueError(
"{} not an acceptable value for format_property "
"{}. Choices are {}.".format(
value, format_property, available_formats[format_property]
)
f"{value} not an acceptable value for format_property "
f"{format_property}. Choices are {available_formats[format_property]}."
)
else:
raise ValueError(
Expand Down
4 changes: 1 addition & 3 deletions yt/data_objects/unions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def __iter__(self):
yield from self.sub_types

def __repr__(self):
return "{} Union: '{}' composed of: {}".format(
self._union_type.capitalize(), self.name, self.sub_types
)
return f"{self._union_type.capitalize()} Union: '{self.name}' composed of: {self.sub_types}"


class MeshUnion(Union):
Expand Down
5 changes: 1 addition & 4 deletions yt/fields/xray_emission_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ def _get_data_file(table_type, data_dir=None):
data_dir = supp_data_dir if os.path.exists(supp_data_dir) else "."
data_path = os.path.join(data_dir, data_file)
if not os.path.exists(data_path):
msg = "Failed to find emissivity data file {}! Please download from {}".format(
data_file,
data_url,
)
msg = f"Failed to find emissivity data file {data_file}! Please download from {data_url}"
mylog.error(msg)
raise OSError(msg)
return data_path
Expand Down
8 changes: 4 additions & 4 deletions yt/utilities/lib/cykdtree/tests/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ def strong_scaling(
perstr = "_periodic"
if suppress_final_output:
outstr = "_noout"
fname_plot = "plot_strong_scaling_nproc_{}part{}_{}leafsize{}.png".format(
npart, perstr, leafsize, outstr
fname_plot = (
f"plot_strong_scaling_nproc_{npart}part{perstr}_{leafsize}leafsize{outstr}.png"
)
nproc_list = [1, 2, 4, 8] # , 16]
ndim_list = [2, 3, 4]
Expand Down Expand Up @@ -201,8 +201,8 @@ def weak_scaling(
perstr = "_periodic"
if suppress_final_output:
outstr = "_noout"
fname_plot = "plot_weak_scaling_nproc_{}part{}_{}leafsize{}.png".format(
npart, perstr, leafsize, outstr
fname_plot = (
f"plot_weak_scaling_nproc_{npart}part{perstr}_{leafsize}leafsize{outstr}.png"
)
nproc_list = [1, 2, 4, 8, 16]
ndim_list = [2, 3]
Expand Down
8 changes: 2 additions & 6 deletions yt/utilities/lib/cykdtree/tests/test_kdtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,11 @@ def test_neighbors(periodic=False):
out_str = str(leaf.id)
try:
for d in range(tree.ndim):
out_str += "\nleft: {} {} {}".format(
d, leaf.left_neighbors[d], left_neighbors[d][leaf.id]
)
out_str += f"\nleft: {d} {leaf.left_neighbors[d]} {left_neighbors[d][leaf.id]}"
assert len(left_neighbors[d][leaf.id]) == len(leaf.left_neighbors[d])
for i in range(len(leaf.left_neighbors[d])):
assert left_neighbors[d][leaf.id][i] == leaf.left_neighbors[d][i]
out_str += "\nright: {} {} {}".format(
d, leaf.right_neighbors[d], right_neighbors[d][leaf.id]
)
out_str += f"\nright: {d} {leaf.right_neighbors[d]} {right_neighbors[d][leaf.id]}"
assert len(right_neighbors[d][leaf.id]) == len(leaf.right_neighbors[d])
for i in range(len(leaf.right_neighbors[d])):
assert right_neighbors[d][leaf.id][i] == leaf.right_neighbors[d][i]
Expand Down

0 comments on commit fca7a77

Please sign in to comment.