Skip to content

Commit 7d90a93

Browse files
authored
Merge pull request #4770 from Liam-DeVoe/ignore-up037
claude: enforce ruff UP031 and UP037 lint rules
2 parents a6fffc3 + 22b97f8 commit 7d90a93

5 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎hypothesis/RELEASE.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RELEASE_TYPE: patch
2+
3+
This patch replaces some internal ``%``-style string formatting with f-strings. There is no user-visible change.

‎hypothesis/src/hypothesis/internal/conjecture/data.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -717,10 +717,9 @@ def __init__(
717717
self.start_span(TOP_LABEL)
718718

719719
def __repr__(self) -> str:
720-
return "ConjectureData(%s, %d choices%s)" % (
721-
self.status.name,
722-
len(self.nodes),
723-
", frozen" if self.frozen else "",
720+
return (
721+
f"ConjectureData({self.status.name}, {len(self.nodes)} "
722+
f"choices{', frozen' if self.frozen else ''})"
724723
)
725724

726725
@property

‎hypothesis/src/hypothesis/internal/conjecture/junkdrawer.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,10 @@ def __enter__(self) -> None:
381381
# is happening and it's hard to imagine an
382382
# intentionally-deeply-recursive use of this code.
383383
assert cur_depth <= 1000, (
384-
"Hypothesis would usually add %d to the stack depth of %d here, "
385-
"but we are already much deeper than expected. Aborting now, to "
386-
"avoid extending the stack limit in an infinite loop..."
387-
% (self.new_limit - self.old_limit, self.old_limit)
384+
f"Hypothesis would usually add {self.new_limit - self.old_limit} to "
385+
f"the stack depth of {self.old_limit} here, but we are already much "
386+
"deeper than expected. Aborting now, to avoid extending the stack "
387+
"limit in an infinite loop..."
388388
)
389389
try:
390390
_stackframe_limiter.enter_context(

‎hypothesis/src/hypothesis/provisional.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ def __init__(
106106
label_regex = r"[a-zA-Z][a-zA-Z0-9]?"
107107
else:
108108
maximum_center_character_pattern_repetitions = self.max_element_length - 2
109-
label_regex = r"[a-zA-Z]([a-zA-Z0-9\-]{0,%d}[a-zA-Z0-9])?" % (
110-
maximum_center_character_pattern_repetitions,
109+
label_regex = (
110+
r"[a-zA-Z]([a-zA-Z0-9\-]{0,"
111+
f"{maximum_center_character_pattern_repetitions}"
112+
r"}[a-zA-Z0-9])?"
111113
)
112114

113115
# Construct reusable strategies here to avoid a performance hit by doing

‎pyproject.toml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ ignore = [
7878
"SIM114",
7979
"SIM300",
8080
"SIM905",
81-
"UP031",
82-
"UP037",
8381
]
8482

8583
[tool.ruff.lint.per-file-ignores]

0 commit comments

Comments
 (0)