Enable pylint, black and flake8 in tox.ini
Change-Id: I5e252eb4802b79497a3fdfea63488668d8a8c692
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_nbi/base_topic.py b/osm_nbi/base_topic.py
index 591d71a..820bd8e 100644
--- a/osm_nbi/base_topic.py
+++ b/osm_nbi/base_topic.py
@@ -29,6 +29,7 @@
self.http_code = http_code
super(Exception, self).__init__(message)
+
class NBIBadArgumentsException(Exception):
"""
Bad argument values exception
@@ -40,9 +41,8 @@
self.bad_args = bad_args
def __str__(self):
- return "{}, Bad arguments: {}".format(
- self.message, self.bad_args
- )
+ return "{}, Bad arguments: {}".format(self.message, self.bad_args)
+
def deep_get(target_dict, key_list):
"""
@@ -59,9 +59,7 @@
return target_dict
-def detect_descriptor_usage(
- descriptor: dict, db_collection: str, db: object
-) -> bool:
+def detect_descriptor_usage(descriptor: dict, db_collection: str, db: object) -> bool:
"""Detect the descriptor usage state.
Args:
@@ -88,7 +86,9 @@
}
if db_collection not in search_dict:
- raise NBIBadArgumentsException("db_collection should be equal to vnfds or nsds", "db_collection")
+ raise NBIBadArgumentsException(
+ "db_collection should be equal to vnfds or nsds", "db_collection"
+ )
record_list = db.get_list(
search_dict[db_collection][0],
@@ -99,7 +99,9 @@
return True
except (DbException, KeyError, NBIBadArgumentsException) as error:
- raise EngineException(f"Error occured while detecting the descriptor usage: {error}")
+ raise EngineException(
+ f"Error occured while detecting the descriptor usage: {error}"
+ )
def update_descriptor_usage_state(
@@ -126,10 +128,14 @@
"_admin.usageState": "IN_USE",
}
- db.set_one(db_collection, {"_id": descriptor["_id"]}, update_dict=descriptor_update)
+ db.set_one(
+ db_collection, {"_id": descriptor["_id"]}, update_dict=descriptor_update
+ )
except (DbException, KeyError, NBIBadArgumentsException) as error:
- raise EngineException(f"Error occured while updating the descriptor usage state: {error}")
+ raise EngineException(
+ f"Error occured while updating the descriptor usage state: {error}"
+ )
def get_iterable(input_var):