From 59a5d1283a01bd1d02bbcebc39e4ffd7c061a6e7 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 2 Oct 2018 17:47:28 +0100 Subject: [PATCH] Make use of str.partition in Utils.parse_docstring --- src/Utils.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Utils.py b/src/Utils.py index ebf82f82..2f1782bc 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -337,14 +337,9 @@ def parse_docstring(s): 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 + key, _, value = line.partition(": ") + last_item = value + items[value] = value else: if last_item: items[last_item] += " %s" % line