Fix pep8 new warnings

A recent change in pep/pycodingchecks introduced new warnings as part of
the pep8 target that causes pep8 to fail now.

This patch fixes code that issued warnings W503,E731,E266,E402

Change-Id: Ib0ad4d722eb6ce322d7f72a5bdaf38b6cb85937e
This commit is contained in:
Adit Sarfaty 2018-04-12 09:12:46 +03:00
parent 4c7f3c384f
commit 8e4af6aa2b
4 changed files with 12 additions and 10 deletions

View File

@ -180,7 +180,7 @@ class TestNSGroupManager(nsxlib_testcase.NsxLibTestCase):
cont_manager = ns_group_manager.NSGroupManager(self.nsxlib, size)
# We expect that the first suggested index is 2
expected_suggested_groups = NSG_IDS[2:5] + NSG_IDS[:2]
suggest_group = lambda: cont_manager._suggest_nested_group('fake-id')
with mock.patch.object(cont_manager, '_hash_uuid', return_value=7):
for i, suggested in enumerate(suggest_group()):
for i, suggested in enumerate(
cont_manager._suggest_nested_group('fake-id')):
self.assertEqual(expected_suggested_groups[i], suggested)

View File

@ -319,10 +319,12 @@ class TestPolicyGroup(NsxPolicyLibTestCase):
'key': policy_constants.CONDITION_KEY_TAG,
'value': 'abc',
'operator': policy_constants.CONDITION_OP_EQUALS}
with mock.patch.object(self.policy_api, "get",
return_value={'expression': [old_cond]}) as get_call,\
mock.patch.object(self.policy_api,
"create_or_update") as update_call:
with mock.patch.object(
self.policy_api, "get",
return_value={'expression': [old_cond]}) as get_call,\
mock.patch.object(
self.policy_api,
"create_or_update") as update_call:
self.resourceApi.update_condition(domain_id, id,
cond_val=None,
tenant=TEST_TENANT)

View File

@ -425,8 +425,8 @@ class ClusteredAPI(object):
conns.spawn(self._validate, endpoint)
eventlet.sleep(0)
while conns.running():
if (self.health == ClusterHealth.GREEN
or self.health == ClusterHealth.ORANGE):
if (self.health == ClusterHealth.GREEN or
self.health == ClusterHealth.ORANGE):
# only wait for 1 or more endpoints to reduce init time
break
eventlet.sleep(0.5)

View File

@ -252,8 +252,8 @@ class NsxLibFirewallSection(utils.NsxLibApiBase):
self._create_with_retry(resource, body)
def remove_member_from_fw_exclude_list(self, target_id, target_type):
resource = ('firewall/excludelist?action=remove_member&object_id='
+ target_id)
resource = ('firewall/excludelist?action=remove_member&object_id=' +
target_id)
self._create_with_retry(resource)
def get_excludelist(self):