|
32 | 32 | from __future__ import generator_stop |
33 | 33 |
|
34 | 34 | import os |
35 | | -import os.path as osp |
36 | 35 | import logging |
37 | 36 | import subprocess |
38 | 37 | import shutil |
39 | 38 | from collections import UserList |
40 | 39 | import pathlib |
41 | 40 |
|
| 41 | +import dask.distributed |
42 | 42 | import jinja2 |
43 | | -from reportengine.compat import yaml |
44 | | - |
45 | 43 |
|
46 | 44 | from . import configparser |
47 | 45 | from . resourcebuilder import target_map |
|
52 | 50 | from . import styles |
53 | 51 | from . import filefinder |
54 | 52 | from . import floatformatting |
55 | | - |
56 | | -import dask.distributed |
| 53 | +from . utils import yaml_rt |
57 | 54 |
|
58 | 55 | log = logging.getLogger(__name__) |
59 | 56 |
|
| 57 | + |
60 | 58 | __all__ = ('report', 'Config') |
61 | 59 |
|
62 | 60 |
|
63 | 61 | def _process_template_text(source, *, filename=None): |
64 | 62 | if filename: |
65 | 63 | #PY36 |
66 | | - log.debug("Processing template %s" % osp.abspath(str(filename))) |
| 64 | + log.debug("Processing template %s" % os.path.abspath(str(filename))) |
67 | 65 |
|
68 | 66 | root = {} |
69 | 67 | d = root |
@@ -111,7 +109,7 @@ class JinjaEnv(jinja2.Environment): |
111 | 109 |
|
112 | 110 | def preprocess(self, source, name=None, filename=None): |
113 | 111 | if filename: |
114 | | - log.debug("Processing template %s" % osp.abspath(filename)) |
| 112 | + log.debug("Processing template %s" % os.path.abspath(filename)) |
115 | 113 |
|
116 | 114 | root = {} |
117 | 115 | d = root |
@@ -213,12 +211,13 @@ def meta_file(output_path, meta:(dict, type(None))=None): |
213 | 211 | path = output_path/fname |
214 | 212 | with open(path, 'w') as f: |
215 | 213 | f.write('\n') |
216 | | - #Using round_trip_dump is important here because the input dict may |
217 | | - #be a recursive commented map, which yaml.dump (or safe_dumo) doesn't |
218 | | - #know how to |
219 | | - #process correctly. |
220 | | - yaml.round_trip_dump(meta, f, explicit_start=True, explicit_end=True, |
221 | | - default_flow_style=False) |
| 214 | + #Using round_trip_dump is important here because the input dict may be a |
| 215 | + #recursive commented map, which yaml.dump (or safe_dumo) doesn't know |
| 216 | + #how to process correctly. |
| 217 | + yaml_rt.explicit_start=True |
| 218 | + yaml_rt.explicit_end=True |
| 219 | + yaml_rt.default_flow_style=False |
| 220 | + yaml_rt.dump(meta, f) |
222 | 221 | return fname |
223 | 222 |
|
224 | 223 | def pandoc_template(*, templatename='report.template', output_path): |
|
0 commit comments