__date__ ="$08-sep-2014 12:21:22$"
import datetime
+import warnings
from jsonschema import validate as js_v, exceptions as js_e
#from bs4 import BeautifulSoup
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
+
+def deprecated(message):
+ def deprecated_decorator(func):
+ def deprecated_func(*args, **kwargs):
+ warnings.warn("{} is a deprecated function. {}".format(func.__name__, message),
+ category=DeprecationWarning,
+ stacklevel=2)
+ warnings.simplefilter('default', DeprecationWarning)
+ return func(*args, **kwargs)
+ return deprecated_func
+ return deprecated_decorator
\ No newline at end of file