summaryrefslogtreecommitdiff
path: root/src/scripts/pyolian/generator.py
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2019-09-29 10:19:11 +0200
committerDave Andreoli <dave@gurumeditation.it>2019-09-29 10:19:11 +0200
commitd1e27aacfc9ba004ec8f7ca083154032dbaab4ce (patch)
treead90f3cd68a0cd224499c51bfa934a24251ffcf3 /src/scripts/pyolian/generator.py
parenta864d62ecfeb09177cc4f4d311351477879e229e (diff)
Pyolian: reformat code to make pycharm happy
and fix some typos in the code
Diffstat (limited to 'src/scripts/pyolian/generator.py')
-rwxr-xr-xsrc/scripts/pyolian/generator.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/scripts/pyolian/generator.py b/src/scripts/pyolian/generator.py
index 5d119d3511..71fb312ad6 100755
--- a/src/scripts/pyolian/generator.py
+++ b/src/scripts/pyolian/generator.py
@@ -41,6 +41,7 @@ PYTHON_PATH, fe:
41""" 41"""
42import os 42import os
43import datetime 43import datetime
44import atexit
44 45
45try: 46try:
46 from . import eolian 47 from . import eolian
@@ -70,11 +71,13 @@ if not eolian_db.all_eot_files_parse():
70if not eolian_db.all_eo_files_parse(): 71if not eolian_db.all_eo_files_parse():
71 raise(RuntimeError('Eolian, failed to parse all EO files')) 72 raise(RuntimeError('Eolian, failed to parse all EO files'))
72 73
74
73# cleanup the database on exit 75# cleanup the database on exit
74import atexit
75def cleanup_db(): 76def cleanup_db():
76 global eolian_db 77 global eolian_db
77 del eolian_db 78 del eolian_db
79
80
78atexit.register(cleanup_db) 81atexit.register(cleanup_db)
79 82
80 83
@@ -92,11 +95,12 @@ class Template(pyratemp.Template):
92 filename: Template file to load. (REQUIRED) 95 filename: Template file to load. (REQUIRED)
93 context: User provided context for the template (dict). 96 context: User provided context for the template (dict).
94 """ 97 """
98
95 def __init__(self, filename, encoding='utf-8', context=None, escape=None, 99 def __init__(self, filename, encoding='utf-8', context=None, escape=None,
96 loader_class=pyratemp.LoaderFile, 100 loader_class=pyratemp.LoaderFile,
97 parser_class=pyratemp.Parser, 101 parser_class=pyratemp.Parser,
98 renderer_class=pyratemp.Renderer, 102 renderer_class=pyratemp.Renderer,
99 eval_class=pyratemp.EvalPseudoSandbox): 103 eval_class=pyratemp.EvalPseudoSandbox):
100 104
101 # Build the global context for the template 105 # Build the global context for the template
102 global_ctx = {} 106 global_ctx = {}
@@ -154,7 +158,7 @@ class Template(pyratemp.Template):
154 eval_class=eval_class) 158 eval_class=eval_class)
155 159
156 def render(self, filename=None, verbose=True, cls=None, ns=None, 160 def render(self, filename=None, verbose=True, cls=None, ns=None,
157 struct=None, enum=None, alias=None, **kargs): 161 struct=None, enum=None, alias=None, **kargs):
158 # Build the context for the template 162 # Build the context for the template
159 ctx = {} 163 ctx = {}
160 if kargs: 164 if kargs: