de15655cfe3c0890334a32cb79d46c810bb9ee07
5 from collections
import OrderedDict
7 # Regular expression for comments
8 comment_re
= re
.compile(
9 '(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
10 re
.DOTALL | re
.MULTILINE
13 def load_config(filepath
):
15 Load config from filepath
17 with
open(filepath
) as f
:
18 content
= ''.join(f
.readlines())
19 match
= comment_re
.search(content
)
21 content
= content
[:match
.start()] + content
[match
.end():]
22 match
= comment_re
.search(content
)
23 return json
.loads(content
, object_pairs_hook
=OrderedDict
)
29 rainbow_config
= os
.environ
.get(
33 '')) + os
.sep
+ '.rainbow_config.json'
35 data
= load_config(rainbow_config
)
42 theme_file
= os
.path
.dirname(
43 __file__
) + '/colorset/' + c
['THEME'] + '.json'
45 data
= load_config(theme_file
)