@@ -19,28 +19,26 @@ def parse_config(markdown_contents):
19
19
20
20
config [section ] = lines
21
21
22
- flat_keys = [key for key in config .keys () if key != ' searchTerms' ]
22
+ flat_keys = [key for key in config .keys () if key != " searchTerms" ]
23
23
for key in flat_keys :
24
24
config [key ] = " " .join (config [key ])
25
- if 'searchTerms' in config :
26
- config ['searchTerms' ] = [
27
- re .compile (r"^- " ).sub ("" , term )
28
- for term
29
- in config ['searchTerms' ]
25
+ if "searchTerms" in config :
26
+ config ["searchTerms" ] = [
27
+ re .compile (r"^- " ).sub ("" , term ) for term in config ["searchTerms" ]
30
28
]
31
- if ' avatar' in config :
32
- matches = re .compile ("^.*\((.+)\)$" ).match (config [' avatar' ])
29
+ if " avatar" in config :
30
+ matches = re .compile ("^.*\((.+)\)$" ).match (config [" avatar" ])
33
31
if matches :
34
- config [' avatar' ] = matches .group (1 )
35
- if ' recordName' in config :
36
- record_name = config [' recordName' ]
37
- record_name = record_name .replace (' ' , '' ).lower ()
32
+ config [" avatar" ] = matches .group (1 )
33
+ if " recordName" in config :
34
+ record_name = config [" recordName" ]
35
+ record_name = record_name .replace (" " , "" ).lower ()
38
36
record_name = record_name [0 :15 ]
39
- config [' recordName' ] = record_name
40
- if ' displayName' in config :
41
- display_name = config [' displayName' ]
37
+ config [" recordName" ] = record_name
38
+ if " displayName" in config :
39
+ display_name = config [" displayName" ]
42
40
display_name = display_name [0 :24 ]
43
- config [' displayName' ] = display_name
41
+ config [" displayName" ] = display_name
44
42
45
43
return config
46
44
@@ -57,12 +55,14 @@ def replace_json_config(worker_js_path, config):
57
55
if len (sections ) != 2 :
58
56
raise Exception ("Expected to find sentinel in worker.js" )
59
57
60
- new_contents = "" .join ([
61
- sections [0 ],
62
- WORKER_SENTINEL ,
63
- "const CONFIG = " + json .dumps (config , indent = 2 ),
64
- "\n " ,
65
- ])
58
+ new_contents = "" .join (
59
+ [
60
+ sections [0 ],
61
+ WORKER_SENTINEL ,
62
+ "const CONFIG = " + json .dumps (config , indent = 2 ),
63
+ "\n " ,
64
+ ]
65
+ )
66
66
67
67
with open (worker_js_path , "w" ) as f :
68
68
f .write (new_contents )
0 commit comments