(jinja_dir, cache_dir, config)
| 195 | |
| 196 | |
| 197 | def initialize_jinja_env(jinja_dir, cache_dir, config): |
| 198 | # pylint: disable=F0401 |
| 199 | sys.path.insert(1, os.path.abspath(jinja_dir)) |
| 200 | import jinja2 |
| 201 | |
| 202 | jinja_env = jinja2.Environment( |
| 203 | loader=jinja2.FileSystemLoader(module_path), |
| 204 | # Bytecode cache is not concurrency-safe unless pre-cached: |
| 205 | # if pre-cached this is read-only, but writing creates a race condition. |
| 206 | bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), |
| 207 | keep_trailing_newline=True, # newline-terminate generated files |
| 208 | lstrip_blocks=True, # so can indent control flow tags |
| 209 | trim_blocks=True) |
| 210 | jinja_env.filters.update({ |
| 211 | "to_title_case": to_title_case, |
| 212 | "dash_to_camelcase": dash_to_camelcase, |
| 213 | "to_method_case": functools.partial(to_method_case, config)}) |
| 214 | jinja_env.add_extension("jinja2.ext.loopcontrols") |
| 215 | return jinja_env |
| 216 | |
| 217 | |
| 218 | def create_imported_type_definition(domain_name, type, imported_namespace): |
no test coverage detected
searching dependent graphs…