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:
Tim Burke
2016年09月16日 13:31:35 -07:00
parent acb8971c76
commit a741998bff

View File

@@ -266,7 +266,7 @@ class Auditor(object):
responses[node_id][1].extend(results)
if results:
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'])
for header in headers]
if len(set(cont_counts)) != 1:

View File

@@ -412,7 +412,7 @@ class HTMLViewer(object):
nfls.append(func[2])
performance.append(metric[metric_selected])
y_pos = range(len(nfls))
error = [random.random() for __ in y_pos]
error = [random.random() for _unused in y_pos]
plt.clf()
if plot_type == 'pie':
plt.pie(x=performance, explode=None, labels=nfls,

View File

@@ -392,11 +392,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
# at this point two primaries have old policy
container_part, container_nodes = self.container_ring.get_nodes(
self.account, self.container_name)
head_responses = []
for node in container_nodes:
metadata = direct_client.direct_head_container(
node, container_part, self.account, self.container_name)
head_responses.append((node, metadata))
head_responses = [
(node, direct_client.direct_head_container(
node, container_part, self.account, self.container_name))
for node in container_nodes]
old_container_node_ids = [
node['id'] for node, metadata in head_responses
if int(old_policy) ==

View File

@@ -2209,8 +2209,8 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
fragment_payloads.append(fragments)
# join up the fragment payloads per node
ec_archive_bodies = [''.join(fragments)
for fragments in zip(*fragment_payloads)]
ec_archive_bodies = [''.join(frags)
for frags in zip(*fragment_payloads)]
return ec_archive_bodies
def _make_ec_object_stub(self, test_body=None, policy=None):

View File

@@ -98,7 +98,6 @@ commands = bandit -c bandit.yaml -r swift bin -n 5 -p gate
[flake8]
# it's not a bug that we aren't using all of hacking, ignore:
# F812: list comprehension redefines ...
# H101: Use TODO(NAME)
# H202: assertRaises Exception too broad
# 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
# H405: multi line docstring summary not separated with an empty line
# 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
filename = *.py,bin/*
show-source = True
Reference in New Issue
openstack/swift
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.