Adding flake8 tests over some files
Change-Id: Ic00ddca13ac3dfa21b1279030026891239989e28
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_ro/wim/persistence.py b/osm_ro/wim/persistence.py
index 2e72640..636676a 100644
--- a/osm_ro/wim/persistence.py
+++ b/osm_ro/wim/persistence.py
@@ -45,7 +45,7 @@
from itertools import groupby
from operator import itemgetter
from sys import exc_info
-from time import time
+# from time import time
from uuid import uuid1 as generate_uuid
from six import reraise
@@ -681,8 +681,7 @@
'LIMIT {:d},{:d}').format(
self.safe_str(wim_account_id),
','.join(type_options),
- group_offset, group_limit
- )
+ group_offset, group_limit)
join = 'vim_wim_actions NATURAL JOIN ({}) AS items'.format(items)
db_results = self.db.get_rows(
@@ -697,7 +696,7 @@
'task_index': task_index}
try:
action = self.query_one('vim_wim_actions', WHERE=condition)
- except:
+ except Exception:
actions = self.query('vim_wim_actions', WHERE=condition)
self.logger.error('More then one action found:\n%s',
json.dumps(actions, indent=4))
@@ -710,8 +709,7 @@
updates = preprocess_record(
merge_dicts(action, properties, extra=extra))
- num_changes = self.db.update_rows('vim_wim_actions',
- UPDATE=updates, WHERE=condition)
+ num_changes = self.db.update_rows('vim_wim_actions', UPDATE=updates, WHERE=condition)
if num_changes is None:
raise UnexpectedDatabaseError(
@@ -782,8 +780,7 @@
if not changes:
return 0
- return self.db.update_rows('instance_actions',
- WHERE={'uuid': uuid}, UPDATE=changes)
+ return self.db.update_rows('instance_actions', WHERE={'uuid': uuid}, UPDATE=changes)
def get_only_vm_with_external_net(self, instance_net_id, **kwargs):
"""Return an instance VM if that is the only VM connected to an
diff --git a/osm_ro/wim/tests/fixtures.py b/osm_ro/wim/tests/fixtures.py
index cb662ab..c39e9d7 100644
--- a/osm_ro/wim/tests/fixtures.py
+++ b/osm_ro/wim/tests/fixtures.py
@@ -121,9 +121,8 @@
def datacenter_tenant_association(datacenter, tenant):
return {'nfvo_tenant_id': uuid('tenant%d' % tenant),
- 'datacenter_id': uuid('dc%d' % datacenter),
- 'datacenter_tenant_id':
- uuid('dc-account%d%d' % (tenant, datacenter))}
+ 'datacenter_id': uuid('dc%d' % datacenter),
+ 'datacenter_tenant_id': uuid('dc-account%d%d' % (tenant, datacenter))}
def datacenter_set(identifier=0, tenant=0):
diff --git a/osm_ro/wim/wim_thread.py b/osm_ro/wim/wim_thread.py
index fa64fbb..f8d52bb 100644
--- a/osm_ro/wim/wim_thread.py
+++ b/osm_ro/wim/wim_thread.py
@@ -51,7 +51,7 @@
from six import reraise
from six.moves import queue
-from . import wan_link_actions, wimconn_odl, wimconn_dynpac # wimconn_tapi
+from . import wan_link_actions, wimconn_odl, wimconn_dynpac # wimconn_tapi
from ..utils import ensure, partition, pipe
from .actions import IGNORE, PENDING, REFRESH
from .errors import (
diff --git a/osm_ro/wim/wimconn_dynpac.py b/osm_ro/wim/wimconn_dynpac.py
index 1816937..c0652e2 100644
--- a/osm_ro/wim/wimconn_dynpac.py
+++ b/osm_ro/wim/wimconn_dynpac.py
@@ -211,8 +211,7 @@
selected_ports = []
for connection_point in connection_points:
endpoint_id = connection_point.get(self.__SERVICE_ENDPOINT_PARAM)
- port = filter(lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM)
- == endpoint_id, port_mapping)[0]
+ port = filter(lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM) == endpoint_id, port_mapping)[0]
wsmpi_json = port.get(self.__WAN_MAPPING_INFO_PARAM)
port_info = json.loads(wsmpi_json)
selected_ports.append(port_info)
@@ -226,7 +225,7 @@
}, {
"wan_switch_dpid": selected_ports[1].get(self.__SW_ID_PARAM),
"wan_switch_port": selected_ports[1].get(self.__SW_PORT_PARAM),
- "wan_vlan": connection_points[1].get(self.__ENCAPSULATION_INFO_PARAM).get(self.__VLAN_PARAM)
+ "wan_vlan": connection_points[1].get(self.__ENCAPSULATION_INFO_PARAM).get(self.__VLAN_PARAM)
}],
"bandwidth": kwargs.get(self.__BANDWIDTH_PARAM),
"service_type": service_type,