5 def read(path
="config"):
6 """Reads in the specified file
8 The file is expected to have the following format:
17 path: The location of the file to read in
19 Returns: A dictionary with the key:value pairs specified in the file.
24 if not os
.path
.isfile(path
):
28 lines
= file.readlines()
31 pos
= lines
.index("[GitStats]\n")
38 # Remove spaces and newlines
39 stripline
= line
.lstrip().rstrip()
41 if stripline
== line
or not stripline
:
44 # Extract the key:value pair
45 splitline
= stripline
.split(' = ')
46 key
= splitline
[0].rstrip()
47 value
= splitline
[1].lstrip()
53 if __name__
== '__main__':
56 for key
, value
in result
.iteritems():
57 print(key
+ ": " + value
)