diff options
Diffstat (limited to 'src/Utils.py')
| -rw-r--r-- | src/Utils.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Utils.py b/src/Utils.py index b5fa8452..e87330c2 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -313,3 +313,35 @@ def get_hashflags(filename): value = line_split[1] hashflags[hashflag] = value return hashflags.items() + +class Docstring(object): + def __init__(self, description, items): + self.description = description + self.items = items + +def parse_docstring(s): + description = "" + last_item = None + items = {} + if s: + for line in s.split("\n"): + line = line.strip() + + if line: + if line[0] == ":": + line_split = line.split(": ", 1) + + value = None + if len(line_split) > 1: + value = line_split[1] + + last_item = line_split[0][1:].lower() + items[last_item] = value + else: + if last_item: + items[last_item] += " %s" % line + else: + if description: + description += " " + description += line + return Docstring(description, items) |
