Skip to content

Commit 29d562c

Browse files
authored
misc: ruff rules E741 and YTT204 (#425)
1 parent 4893898 commit 29d562c

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

compiler_opt/distributed/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_full_worker_args(worker_class: 'type[Worker]', **current_kwargs):
105105
# it's not a requirement that it were. Tests, for instance, don't use gin.
106106
pass
107107
# Issue #38
108-
if sys.version_info.minor >= 9:
108+
if sys.version_info >= (3, 9):
109109
return current_kwargs | gin_config
110110
else:
111111
return {**current_kwargs, **gin_config}

compiler_opt/rl/data_collector_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_build_distribution_monitor(self):
3030
monitor_dict = data_collector.build_distribution_monitor(data)
3131
reference_dict = {'mean': 2, 'p_0.1': 1}
3232
# Issue #38
33-
if sys.version_info.minor >= 9:
33+
if sys.version_info >= (3, 9):
3434
self.assertEqual(monitor_dict, monitor_dict | reference_dict)
3535
else:
3636
self.assertEqual(monitor_dict, {**monitor_dict, **reference_dict})

compiler_opt/rl/imitation_learning/weighted_bc_trainer_lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ def _create_weights(self, labels, weights_arr):
338338

339339
def _get_loss_fn(self, y_true, y_pred, labels, weights_arr):
340340
weights = tf.ones_like(y_true, dtype=tf.float64)
341-
for l, wa in zip(labels, weights_arr):
342-
w = self._create_weights(l, wa)
341+
for label, wa in zip(labels, weights_arr):
342+
w = self._create_weights(label, wa)
343343
w = tf.reshape(w, [-1, 1])
344344
weights = tf.math.multiply(w, weights)
345345
bce = tf.keras.losses.BinaryCrossentropy(from_logits=False)

compiler_opt/rl/local_data_collector_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def _test_iterator_fn(data_list):
181181
}
182182
}
183183
# Issue #38
184-
if sys.version_info.minor >= 9:
184+
if sys.version_info >= (3, 9):
185185
self.assertEqual(monitor_dict,
186186
monitor_dict | expected_monitor_dict_subset)
187187
else:
@@ -201,7 +201,7 @@ def _test_iterator_fn(data_list):
201201
}
202202
}
203203
# Issue #38
204-
if sys.version_info.minor >= 9:
204+
if sys.version_info >= (3, 9):
205205
self.assertEqual(monitor_dict,
206206
monitor_dict | expected_monitor_dict_subset)
207207
else:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.ruff]
22
line-length = 103
3-
lint.select = [ "C40", "C9", "E", "F", "PERF", "W" ]
4-
lint.ignore = [ "E722", "E731", "E741", "F401", "PERF203" ]
3+
lint.select = [ "C40", "C9", "E", "F", "PERF", "W", "YTT" ]
4+
lint.ignore = [ "E722", "E731", "F401", "PERF203" ]
55
lint.mccabe.max-complexity = 18
66

77
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)