Turn on F812 check
F812 list comprehension redefines <variable> from line ... While the current violations were benign, this sort of code can easily lead to subtle bugs. Seems worth checking, especially given how cheap it is to bring existing code in line with it. Change-Id: Ibdcf9f93b85a1f1411198001df6bdbfa8f92d114
This commit is contained in:
parent
acb8971c76
commit
a741998bff
@ -266,7 +266,7 @@ class Auditor(object):
|
|||||||
responses[node_id][1].extend(results)
|
responses[node_id][1].extend(results)
|
||||||
if results:
|
if results:
|
||||||
marker = results[-1]['name']
|
marker = results[-1]['name']
|
||||||
headers = [resp[0] for resp in responses.values()]
|
headers = [r[0] for r in responses.values()]
|
||||||
cont_counts = [int(header['x-account-container-count'])
|
cont_counts = [int(header['x-account-container-count'])
|
||||||
for header in headers]
|
for header in headers]
|
||||||
if len(set(cont_counts)) != 1:
|
if len(set(cont_counts)) != 1:
|
||||||
|
@ -412,7 +412,7 @@ class HTMLViewer(object):
|
|||||||
nfls.append(func[2])
|
nfls.append(func[2])
|
||||||
performance.append(metric[metric_selected])
|
performance.append(metric[metric_selected])
|
||||||
y_pos = range(len(nfls))
|
y_pos = range(len(nfls))
|
||||||
error = [random.random() for __ in y_pos]
|
error = [random.random() for _unused in y_pos]
|
||||||
plt.clf()
|
plt.clf()
|
||||||
if plot_type == 'pie':
|
if plot_type == 'pie':
|
||||||
plt.pie(x=performance, explode=None, labels=nfls,
|
plt.pie(x=performance, explode=None, labels=nfls,
|
||||||
|
@ -392,11 +392,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
|
|||||||
# at this point two primaries have old policy
|
# at this point two primaries have old policy
|
||||||
container_part, container_nodes = self.container_ring.get_nodes(
|
container_part, container_nodes = self.container_ring.get_nodes(
|
||||||
self.account, self.container_name)
|
self.account, self.container_name)
|
||||||
head_responses = []
|
head_responses = [
|
||||||
for node in container_nodes:
|
(node, direct_client.direct_head_container(
|
||||||
metadata = direct_client.direct_head_container(
|
node, container_part, self.account, self.container_name))
|
||||||
node, container_part, self.account, self.container_name)
|
for node in container_nodes]
|
||||||
head_responses.append((node, metadata))
|
|
||||||
old_container_node_ids = [
|
old_container_node_ids = [
|
||||||
node['id'] for node, metadata in head_responses
|
node['id'] for node, metadata in head_responses
|
||||||
if int(old_policy) ==
|
if int(old_policy) ==
|
||||||
|
@ -2209,8 +2209,8 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
|
|||||||
fragment_payloads.append(fragments)
|
fragment_payloads.append(fragments)
|
||||||
|
|
||||||
# join up the fragment payloads per node
|
# join up the fragment payloads per node
|
||||||
ec_archive_bodies = [''.join(fragments)
|
ec_archive_bodies = [''.join(frags)
|
||||||
for fragments in zip(*fragment_payloads)]
|
for frags in zip(*fragment_payloads)]
|
||||||
return ec_archive_bodies
|
return ec_archive_bodies
|
||||||
|
|
||||||
def _make_ec_object_stub(self, test_body=None, policy=None):
|
def _make_ec_object_stub(self, test_body=None, policy=None):
|
||||||
|
3
tox.ini
3
tox.ini
@ -98,7 +98,6 @@ commands = bandit -c bandit.yaml -r swift bin -n 5 -p gate
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# it's not a bug that we aren't using all of hacking, ignore:
|
# it's not a bug that we aren't using all of hacking, ignore:
|
||||||
# F812: list comprehension redefines ...
|
|
||||||
# H101: Use TODO(NAME)
|
# H101: Use TODO(NAME)
|
||||||
# H202: assertRaises Exception too broad
|
# H202: assertRaises Exception too broad
|
||||||
# H233: Python 3.x incompatible use of print operator
|
# H233: Python 3.x incompatible use of print operator
|
||||||
@ -109,7 +108,7 @@ commands = bandit -c bandit.yaml -r swift bin -n 5 -p gate
|
|||||||
# H404: multi line docstring should start without a leading new line
|
# H404: multi line docstring should start without a leading new line
|
||||||
# H405: multi line docstring summary not separated with an empty line
|
# H405: multi line docstring summary not separated with an empty line
|
||||||
# H501: Do not use self.__dict__ for string formatting
|
# H501: Do not use self.__dict__ for string formatting
|
||||||
ignore = F812,H101,H202,H301,H306,H401,H403,H404,H405,H501
|
ignore = H101,H202,H301,H306,H401,H403,H404,H405,H501
|
||||||
exclude = .venv,.tox,dist,*egg
|
exclude = .venv,.tox,dist,*egg
|
||||||
filename = *.py,bin/*
|
filename = *.py,bin/*
|
||||||
show-source = True
|
show-source = True
|
||||||
|
Loading…
Reference in New Issue
Block a user