Enhance sdn-assist reporting
Change-Id: I77d4600bc45f0eb64c849d38a4246df24c276707
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_ro/utils.py b/osm_ro/utils.py
index 00f6f2d..c7d966e 100644
--- a/osm_ro/utils.py
+++ b/osm_ro/utils.py
@@ -178,4 +178,21 @@
except js_e.ValidationError:
return False
return False
-
+
+
+def expand_brackets(text):
+ """
+ Change a text with TEXT[ABC..] into a list with [TEXTA, TEXTB, TEXC, ...
+ if no bracket is used it just return the a list with the single text
+ It uses recursivity to allow several [] in the text
+ :param text:
+ :return:
+ """
+ start = text.find("[")
+ end = text.find("]")
+ if start < 0 or end < 0:
+ return [text]
+ text_list = []
+ for char in text[start+1:end]:
+ text_list += expand_brackets(text[:start] + char + text[end+1:])
+ return text_list