Skip to content

Commit da3eb7d

Browse files
Apply the Ruff B rules (#100)
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent 246c983 commit da3eb7d

7 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
- Apply the Ruff `I` rules [#99](https://github.com/python-backoff/backoff/pull/99) (from [@edgarrmondragon](https://github.com/edgarrmondragon))
1010

11+
- Apply the Ruff `B` rules [#100](https://github.com/python-backoff/backoff/pull/100) (from [@edgarrmondragon](https://github.com/edgarrmondragon))
12+
1113
## [v2.3.1] - 2025-12-18
1214

1315
### Fixed

‎backoff/_async.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ async def retry(*args, **kwargs):
177177
seconds = _next_wait(wait, e, jitter, elapsed, max_time_value)
178178
except StopIteration:
179179
await _call_handlers(on_giveup, **details, exception=e)
180-
raise e
180+
raise e from None
181181

182182
await _call_handlers(on_backoff, **details, wait=seconds, exception=e)
183183

‎backoff/_sync.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def retry(*args, **kwargs):
130130
seconds = _next_wait(wait, e, jitter, elapsed, max_time_value)
131131
except StopIteration:
132132
_call_handlers(on_giveup, **details, exception=e)
133-
raise e
133+
raise e from None
134134

135135
_call_handlers(on_backoff, **details, wait=seconds, exception=e)
136136

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ docstring-code-line-length = 20
186186
[tool.ruff.lint]
187187
extend-select = [
188188
"RET", # flake8-return
189+
"B", # flake8-bugbear
189190
"I", # isort
190191
"SIM", # flake8-simplify
191192
"UP", # pyupgrade

‎tests/test_backoff.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ def test_event_log_levels(
939939

940940
backoff_log_count = 0
941941
giveup_log_count = 0
942-
for logger_name, level, message in caplog.record_tuples:
942+
for _logger_name, level, message in caplog.record_tuples:
943943
if level == backoff_log_level and backoff_re.match(message):
944944
backoff_log_count += 1
945945
elif level == giveup_log_level and giveup_re.match(message):

‎tests/test_jitter.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def test_full_jitter():
55
for input in range(100):
6-
for i in range(100):
6+
for _i in range(100):
77
jitter = backoff.full_jitter(input)
88
assert jitter >= 0
99
assert jitter <= input

‎tests/test_wait_gen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_fibo_max_value():
9494
def test_constant():
9595
gen = backoff.constant(interval=3)
9696
gen.send(None)
97-
for i in range(9):
97+
for _i in range(9):
9898
assert next(gen) == 3
9999

100100

0 commit comments

Comments
 (0)