From 8c0a501a793b70b7750073da31dd661cab50212f Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Thu, 24 Jul 2008 18:52:30 +0200 Subject: [PATCH] gitstats: Do not require lines to end with a '\n' in the config parser There is no reason to require this, and it makes testing easier if it is not required. --- src/git_stats/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/git_stats/config.py b/src/git_stats/config.py index 4cd66a2..0dc0f72 100644 --- a/src/git_stats/config.py +++ b/src/git_stats/config.py @@ -70,8 +70,8 @@ def read(lines, convert_camel_case=True): All camelCase keys are converted to dashed_form. The file is expected to have the following format: .* - [GitStats]\n - [key = value\n]* + [GitStats] + [key = value]* .* @@ -88,7 +88,10 @@ def read(lines, convert_camel_case=True): try: pos = lines.index("[GitStats]\n") except ValueError: - return config + try: + pos = lines.index("[GitStats]") + except ValueError: + return config # Kick off the header pos += 1 -- 2.11.4.GIT