Skip to content

Commit dbe1524

Browse files
Revert "MAINT: Apply ruff/flake8-bugbear rule B007"
This reverts commit 77f5922.
1 parent 5a0a68b commit dbe1524

21 files changed

+31
-29
lines changed

asv/commands/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def help(args):
8989
common_args.add_global_arguments(subparser)
9090
del commands[command]
9191

92-
for _name, command in sorted(commands.items()):
92+
for name, command in sorted(commands.items()):
9393
subparser = command.setup_arguments(subparsers)
9494
common_args.add_global_arguments(subparser)
9595

asv/commands/preview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def random_ports(port, n):
2323
port = 8080
2424
for i in range(min(5, n)):
2525
yield port + i
26-
for _ in range(n - 5):
26+
for i in range(n - 5):
2727
yield max(1, port + random.randint(-2 * n, 2 * n))
2828

2929

asv/commands/publish.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def copy_ignore(src, names):
223223

224224
# Get the parameter sets for all graphs
225225
graph_param_list = []
226-
for _path, graph in graphs:
226+
for path, graph in graphs:
227227
if 'summary' not in graph.params:
228228
if graph.params not in graph_param_list:
229229
graph_param_list.append(graph.params)

asv/commands/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,12 @@ def iter_rounds_commits():
371371

372372
for run_rounds, commit_hash in iter_rounds_commits():
373373
if commit_hash in skipped_benchmarks:
374-
for _env in environments:
375-
for _bench in benchmarks:
374+
for env in environments:
375+
for bench in benchmarks:
376376
if interleave_rounds:
377377
log.step()
378378
else:
379-
for _ in range(max_rounds):
379+
for j in range(max_rounds):
380380
log.step()
381381
continue
382382

@@ -387,7 +387,7 @@ def iter_rounds_commits():
387387
if interleave_rounds:
388388
log.step()
389389
else:
390-
for _ in range(max_rounds):
390+
for j in range(max_rounds):
391391
log.step()
392392

393393
active_environments = [env for env in environments

asv/commands/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run(cls, conf, _machine_file=None):
3535

3636
log.info("Updating results data...")
3737

38-
for root, _dirs, files in os.walk(conf.results_dir):
38+
for root, dirs, files in os.walk(conf.results_dir):
3939
for filename in files:
4040
path = os.path.join(root, filename)
4141
if filename == 'machine.json':

asv/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def _combine_graph_data(graphs):
429429
ys = [[None] * len(x_idx) for j in range(n_series)]
430430
pos = 0
431431
for dataset, graph in zip(datasets, graphs):
432-
for k, v, _dv in dataset:
432+
for k, v, dv in dataset:
433433
i = x_idx[k]
434434
if graph.scalar_series:
435435
v = [v]

asv/machine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def iter_machine_files(results_dir):
1616
"""
1717
Iterate over all of the machine.json files in the results_dir
1818
"""
19-
for root, _dirs, files in os.walk(results_dir):
19+
for root, dirs, files in os.walk(results_dir):
2020
for filename in files:
2121
if filename == 'machine.json':
2222
path = os.path.join(root, filename)

asv/plugin_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self):
2525

2626
def load_plugins(self, package):
2727
prefix = package.__name__ + "."
28-
for _module_finder, name, _ispkg in pkgutil.iter_modules(package.__path__, prefix):
28+
for module_finder, name, ispkg in pkgutil.iter_modules(package.__path__, prefix):
2929
try:
3030
mod = importlib.import_module(name)
3131
self.init_plugin(mod)
@@ -38,7 +38,7 @@ def load_plugins(self, package):
3838

3939
def _load_plugin_by_name(self, name):
4040
prefix = plugins.__name__ + "."
41-
for _module_finder, module_name, _ispkg in pkgutil.iter_modules(plugins.__path__, prefix):
41+
for module_finder, module_name, ispkg in pkgutil.iter_modules(plugins.__path__, prefix):
4242
if name in module_name:
4343
mod = importlib.import_module(module_name)
4444
return mod

asv/plugins/regressions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def publish(cls, conf, repo, benchmarks, graphs, revisions):
3030

3131
all_params = graphs.get_params()
3232

33-
for file_name, graph in graphs:
33+
for j, (file_name, graph) in enumerate(graphs):
3434
if 'summary' in graph.params:
3535
continue
3636

@@ -119,7 +119,7 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash):
119119
# Generate feed entries
120120
entries = []
121121

122-
for name, _graph_path, graph_params, idx, last_value, best_value, jumps in data:
122+
for name, graph_path, graph_params, idx, last_value, best_value, jumps in data:
123123
if '(' in name:
124124
benchmark_name = name[:name.index('(')]
125125
else:

asv/results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def iter_results_paths(results):
2222
Iterate over all of the result file paths.
2323
"""
2424
skip_files = {'machine.json', 'benchmarks.json'}
25-
for root, _dirs, files in os.walk(results):
25+
for root, dirs, files in os.walk(results):
2626
# Iterate over files only if machine.json is valid json
2727
machine_json = os.path.join(root, "machine.json")
2828
try:

asv/runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def iter_run_items():
254254
log.error(out)
255255

256256
stderr = 'asv: benchmark suite import failed'
257-
for name, benchmark, _setup_cache_key, _is_final in iter_run_items():
257+
for name, benchmark, setup_cache_key, is_final in iter_run_items():
258258
if name in failed_benchmarks:
259259
continue
260260

@@ -516,7 +516,7 @@ def run_benchmark(benchmark, spawner, profile,
516516
else:
517517
param_iter = [(0, None)]
518518

519-
for param_idx, _params in param_iter:
519+
for param_idx, params in param_iter:
520520
if selected_idx is not None and param_idx not in selected_idx:
521521
result.append(math.nan)
522522
samples.append(None)

asv/step_detect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def detect_regressions(steps, threshold=0, min_size=2):
134134
short_prev = None
135135

136136
# Find upward steps that resulted to worsened value afterward
137-
for l, r, cur_v, _cur_min, cur_err in reversed(steps):
137+
for l, r, cur_v, cur_min, cur_err in reversed(steps):
138138
threshold_step = max(cur_err, thresholded_best_err, threshold * cur_v)
139139

140140
if thresholded_best_v > cur_v + threshold_step:

asv/template/benchmarks/benchmarks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def setup(self):
1313
self.d[x] = None
1414

1515
def time_keys(self):
16-
for _ in self.d.keys():
16+
for key in self.d.keys():
1717
pass
1818

1919
def time_values(self):
20-
for _ in self.d.values():
20+
for value in self.d.values():
2121
pass
2222

2323
def time_range(self):

asv/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def sig_forward(signum, frame):
567567
# Terminate the whole process group
568568
_killpg_safe(proc.pid, signal.SIGTERM)
569569

570-
for _ in range(10):
570+
for j in range(10):
571571
time.sleep(0.1)
572572
if proc.poll() is not None:
573573
break

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ extend-select = [
127127
]
128128
ignore = [
129129
"B006", # TESTING
130+
"B007", # TESTING
130131
"B020", # Loop control variable overrides iterable it iterates
131132
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
132133
"E741", # Do not use variables named 'I', 'O', or 'l'

test/benchmark/peakmem_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ def peakmem_list():
44
# One element takes sizeof(void*) bytes; the code below uses up
55
# 4MB (32-bit) or 8MB (64-bit)
66
obj = [0] * 2**20
7-
for _ in obj:
7+
for x in obj:
88
pass

test/benchmark/subdir/time_subdir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
def time_foo():
55
if x != 42:
66
raise RuntimeError()
7-
for _ in range(1000):
7+
for y in range(1000):
88
pass
99

1010

test/benchmark/time_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ def setup(self):
1616

1717
def time_example_benchmark_1(self):
1818
s = ''
19-
for _ in xrange(self.n):
19+
for i in xrange(self.n):
2020
s = s + 'x'
2121

2222
def time_example_benchmark_2(self):
2323
s = []
24-
for _ in xrange(self.n):
24+
for i in xrange(self.n):
2525
s.append('x')
2626
''.join(s)
2727

test/test_publish.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def test_publish(tmpdir, example_results):
5050
only_branch = [x for x in dvcs.get_branch_hashes('some-branch')
5151
if x not in main_commits]
5252
commits = main_commits + only_branch
53-
for fn, commit in zip(result_files, commits):
53+
for k, item in enumerate(zip(result_files, commits)):
54+
fn, commit = item
5455
src = join(example_results, 'cheetah', fn)
5556
dst = join(result_dir, 'cheetah', commit[:8] + fn[8:])
5657
try:
@@ -434,7 +435,7 @@ def test_regression_atom_feed_update(dvcs_type, tmpdir):
434435

435436
assert len(new_entries) == len(old_entries) == 2
436437

437-
for a, b in zip(new_entries, old_entries):
438+
for j, (a, b) in enumerate(zip(new_entries, old_entries)):
438439
a_id = a.find('{http://www.w3.org/2005/Atom}id')
439440
b_id = b.find('{http://www.w3.org/2005/Atom}id')
440441
assert a_id.text == b_id.text

test/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_run_benchmarks(benchmarks_fixture, tmpdir):
164164
assert 2 <= len(times['time_examples.time_auto_repeat'].samples[0]) <= 4
165165

166166
# Check run time timestamps
167-
for result in times.values():
167+
for name, result in times.items():
168168
assert result.started_at >= util.datetime_to_js_timestamp(start_timestamp)
169169
if any(x is not None for x in result.result):
170170
assert result.duration >= 0

test/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def run():
580580

581581

582582
def get_with_retry(browser, url):
583-
for _ in range(2):
583+
for j in range(2):
584584
try:
585585
return browser.get(url)
586586
except TimeoutException:

0 commit comments

Comments
 (0)