Exemple #1
0
 def __parse_annotation(self, string):
     split = string.split()
     name = split[0].strip()
     if len(split) == 1:
         return Annotation(name=name)
     if '=' in split[1]:
         return self.__parse_key_value_annotation(name, split[1])
     return Annotation(name=name, argument=[split[1]])
Exemple #2
0
 def __parse_key_value_annotation(self, name, string):
     kvs = self.kv_regex.findall(string)
     kvs = {kv.split('=', 1)[0]: kv.split('=', 1)[1] for kv in kvs}
     return Annotation(name=name, argument=kvs)