Skip to content

Commit 56c88fe

Browse files
MAINT: Apply ruff rule RUF010
RUF010 Use explicit conversion flag
1 parent eb6ac83 commit 56c88fe

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

benchmarks/benchmarks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def dirty_lock(lock_name, lock_on_count=1):
4242
count = 0
4343
f.seek(0)
4444
f.truncate()
45-
f.write(f"{str(count)} {str(ppid)}")
45+
f.write(f"{count} {ppid}")
4646
except OSError:
4747
pass
4848
return False

numpy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ def _mac_os_check():
477477
for _wn in w:
478478
if _wn.category is exceptions.RankWarning:
479479
# Ignore other warnings, they may not be relevant (see gh-25433).
480-
error_message = f"{_wn.category.__name__}: {str(_wn.message)}"
480+
error_message = (
481+
f"{_wn.category.__name__}: {_wn.message}"
482+
)
481483
msg = (
482484
"Polyfit sanity test emitted a warning, most likely due "
483485
"to using a buggy Accelerate backend."

numpy/_core/numerictypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def isdtype(dtype, kind):
452452
elif isinstance(kind, str):
453453
raise ValueError(
454454
"kind argument is a string, but"
455-
f" {repr(kind)} is not a known kind name."
455+
f" {kind!r} is not a known kind name."
456456
)
457457
else:
458458
try:

numpy/_core/tests/test_stringdtype.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ def test_dtype_repr(dtype):
116116
if not hasattr(dtype, "na_object") and dtype.coerce:
117117
assert repr(dtype) == "StringDType()"
118118
elif dtype.coerce:
119-
assert repr(dtype) == f"StringDType(na_object={repr(dtype.na_object)})"
119+
assert repr(dtype) == f"StringDType(na_object={dtype.na_object!r})"
120120
elif not hasattr(dtype, "na_object"):
121121
assert repr(dtype) == "StringDType(coerce=False)"
122122
else:
123123
assert (
124124
repr(dtype)
125-
== f"StringDType(na_object={repr(dtype.na_object)}, coerce=False)"
125+
== f"StringDType(na_object={dtype.na_object!r}, coerce=False)"
126126
)
127127

128128

numpy/f2py/_backends/_distutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def compile(self):
4242
i = get_info(n)
4343
if not i:
4444
print(
45-
f"No {repr(n)} resources found"
45+
f"No {n!r} resources found"
4646
"in system (try `f2py --help-link`)"
4747
)
4848
dict_append(ext_args, **i)

0 commit comments

Comments
 (0)