Merge "Remove ruff E741 ignore directive"

This commit is contained in:
Zuul
2026-04-09 17:17:37 +00:00
committed by Gerrit Code Review
5 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -555,8 +555,8 @@ class IptablesManager:
# line error wasn't found, print all lines instead
log_start = 0
log_end = len(commands)
log_lines = ('%7d. %s' % (idx, l)
for idx, l in enumerate(
log_lines = ('%7d. %s' % (idx, line)
for idx, line in enumerate(
commands[log_start:log_end],
log_start + 1)
)
@@ -68,11 +68,11 @@ class OVSAgentTestBase(test_ovs_lib.OVSBridgeTestBase,
trace = {}
trace_lines = t.splitlines()
for line in trace_lines:
(l, sep, r) = line.partition(':')
(b, sep, a) = line.partition(':')
if not sep:
continue
if l in required_keys:
trace[l] = r
if b in required_keys:
trace[b] = a
for k in required_keys:
if k not in trace:
self.fail(f"{k} not found in trace {trace_lines}")
@@ -1242,8 +1242,8 @@ class IptablesFirewallTestCase(BaseIptablesFirewallTestCase):
for filter_inst in [self.v4filter_inst, self.v6filter_inst]:
comb = zip(calls, filter_inst.mock_calls)
for (l, r) in comb:
self.assertEqual(l, r)
for (call, mock_call) in comb:
self.assertEqual(call, mock_call)
filter_inst.assert_has_calls(calls)
self.assertIn(port['id'], self.firewall.trusted_ports)
@@ -1277,8 +1277,8 @@ class IptablesFirewallTestCase(BaseIptablesFirewallTestCase):
for filter_inst in [self.v4filter_inst, self.v6filter_inst]:
comb = zip(calls, filter_inst.mock_calls)
for (l, r) in comb:
self.assertEqual(l, r)
for (call, mock_call) in comb:
self.assertEqual(call, mock_call)
filter_inst.assert_has_calls(calls)
self.assertNotIn(port['id'], self.firewall.trusted_ports)
@@ -1449,8 +1449,8 @@ class IptablesFirewallTestCase(BaseIptablesFirewallTestCase):
top=False, comment=None),
mock.call.add_rule('sg-chain', '-j ACCEPT')]
comb = zip(calls, filter_inst.mock_calls)
for (l, r) in comb:
self.assertEqual(l, r)
for (call, mock_call) in comb:
self.assertEqual(call, mock_call)
filter_inst.assert_has_calls(calls)
def _test_remove_conntrack_entries(self, ethertype, protocol, direction,
@@ -882,8 +882,8 @@ class IptablesManagerStateFulTestCase(IptablesManagerBaseTestCase):
# call.
# Failure without a specific line number in the error should cause
# all lines to be logged with numbers.
logged = ['%7d. %s' % (n, l)
for n, l in enumerate(self.input_lines, 1)]
logged = ['%7d. %s' % (num, line)
for num, line in enumerate(self.input_lines, 1)]
log.error.assert_called_once_with(_(
'IPTablesManager.apply failed to apply the '
'following set of iptables rules:\n%s'),
@@ -927,9 +927,9 @@ class IptablesManagerStateFulTestCase(IptablesManagerBaseTestCase):
ctx = iptables_manager.IPTABLES_ERROR_LINES_OF_CONTEXT
log_start = max(0, 11 - ctx)
log_end = 11 + ctx
logged = ['%7d. %s' % (n, l)
for n, l in enumerate(self.input_lines[log_start:log_end],
log_start + 1)]
logged = ['%7d. %s' % (n, li)
for n, li in enumerate(self.input_lines[log_start:log_end],
log_start + 1)]
log.error.assert_called_once_with(_(
'IPTablesManager.apply failed to apply the '
'following set of iptables rules:\n%s'),
-1
View File
@@ -364,7 +364,6 @@ line-length = 79
select = ["C90", "E", "F", "G", "S", "UP", "W"]
preview = true
ignore = [
"E741", # Ambiguous variable name: `l`
"S104", # Possible binding to all interfaces
"S404", # `subprocess` module is possibly insecure
"UP031", # Use format specifiers instead of percent format