refactor python to support multiple actions
* executable, license header * prefer `with open` style to auto-close file handles * keep hardcoding within __main__
This commit is contained in:
parent
585fde2898
commit
e451a10bf3
|
@ -1,10 +1,15 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
from mako.template import Template
|
||||
import json
|
||||
import itertools
|
||||
import argparse
|
||||
|
||||
appTemplate = Template(filename='./spaces.html')
|
||||
f = open('libregamingspaces.json')
|
||||
spaces=json.load(f)
|
||||
def render(spaces, template):
|
||||
appTemplate = Template(filename=template)
|
||||
print(appTemplate.render(s=spaces))
|
||||
|
||||
print(appTemplate.render(s=spaces))
|
||||
if __name__ == '__main__':
|
||||
with open('libregamingspaces.json') as f:
|
||||
spaces = json.load(f)
|
||||
|
||||
render(spaces, './spaces.html')
|
||||
|
|
Loading…
Reference in New Issue