]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix pylint unbalanced-tuple-unpacking warning
authorCedric Brandily <zzelle@gmail.com>
Fri, 16 Jan 2015 23:41:16 +0000 (23:41 +0000)
committerCedric Brandily <zzelle@gmail.com>
Sun, 18 Jan 2015 11:37:43 +0000 (11:37 +0000)
commitc9974b9269e5e9943c7b920d9a0569dc80ddebb8
tree3022f52a6cdee4f3877f230b4486e76cd9885a30
parente749d3c4ba91972d252bb5f90c87a178f22e2208
Fix pylint unbalanced-tuple-unpacking warning

Pylint last version(1.4.1), at least, reports an
unbalanced-tuple-unpacking warning[1] in keepalived[2] module because
self.authentication is defined as an empty tuple in __init__ method and
unpacked in build_config method as if it was a 2-tuple.

self.authentication references an empty tuple (defined in __init__
method) or a 2-tuple (updated in set_authentication method). Such
warning is a false positive because the unpacking is only performed if
self.authentication is not evaluated to false which only appends if
self.authentication is a 2-tuple.

Defining self.authentication as None in __init__ avoids such warning
without disabling unbalanced-tuple-unpacking warning check.

[1]
W:252,12: Possible unbalanced tuple unpacking with sequence defined at
line 153: left side has 2 label(s), right side has 0 value(s)
(unbalanced-tuple-unpacking)

[2] neutron.agent.linux.keepalived

Change-Id: Ifcdf08e574ef44a65c6d121323cbe31d9af2f921
Closes-Bug: #1411865
.pylintrc
neutron/agent/linux/keepalived.py