Skip to content

Commit

Permalink
style: run newest version of ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
ljgray committed Dec 11, 2024
1 parent 43044bb commit 0553f19
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
11 changes: 4 additions & 7 deletions caput/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,21 +380,18 @@ def _prop(val):
for ii, item in enumerate(val):
if not isinstance(item, type_):
raise CaputConfigError(
"Expected to receive a list with items of type %s, but got "
"'%s' of type '%s' at position %i"
% (type_, item, type(item), ii)
f"Expected to receive a list with items of type {type_!s}, but got "
f"'{item!s}' of type '{type(item)!s}' at position {ii}"
)

if length and len(val) != length:
raise CaputConfigError(
"List expected to be of length %i, but was actually length %i"
% (length, len(val))
f"List expected to be of length {length}, but was actually length {len(val)}"
)

if maxlength and len(val) > maxlength:
raise CaputConfigError(
"Maximum length of list is %i is, but list was actually length %i"
% (maxlength, len(val))
f"Maximum length of list is {maxlength} is, but list was actually length {len(val)}"
)

return val
Expand Down
3 changes: 1 addition & 2 deletions caput/memh5.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,7 @@ def dataset_common_to_distributed(self, name, distributed_axis=0):

if dset.distributed:
warnings.warn(
"%s is already a distributed dataset, redistribute it along the required axis %d"
% (name, distributed_axis)
f"{name!s} is already a distributed dataset, redistribute it along the required axis {distributed_axis}"
)
dset.redistribute(distributed_axis)
return dset
Expand Down
7 changes: 3 additions & 4 deletions caput/mpiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ def from_file(
# Check that the axis is valid and wrap to an actual position
if axis < -naxis or axis >= naxis:
raise AxisException(
"Distributed axis %i not in range (%i, %i)" % (axis, -naxis, naxis - 1)
f"Distributed axis {axis} not in range ({-naxis}, {naxis - 1})"
)
axis = naxis + axis if axis < 0 else axis

Expand Down Expand Up @@ -1642,9 +1642,8 @@ def _partition_io(self, skip=False, threshold=1.99):
break
else:
raise RuntimeError(
"Can't identify an IO partition less than %.2f GB in size: "
"shape=%s, distributed axis=%i"
% (threshold, self.global_shape, self.axis)
f"Can't identify an IO partition less than {threshold:.2f} GB in size: "
f"shape={self.global_shape!s}, distributed axis={self.axis}"
)

axis_length = self.global_shape[split_axis]
Expand Down

0 comments on commit 0553f19

Please sign in to comment.