Commit 56a871d7d7709ff77d9a6a4afff330a99ca21d4b
1 parent
30734700
Change default output format for Munches
Showing
1 changed file
with
12 additions
and
0 deletions
| ... | ... | @@ -21,6 +21,18 @@ eggs = |
| 21 | 21 | robotframework-debuglibrary |
| 22 | 22 | |
| 23 | 23 | interpreter = python_interpreter |
| 24 | +# The following piece of code changes the default output format of Munch | |
| 25 | +# for Munch-to-str conversion and for generation of so-called repr. | |
| 26 | +# | |
| 27 | +# As a result, Robot Framework records pretty human-readable (YAML) data in its | |
| 28 | +# log files instead of ugly piles of Munch(data=Munch(foo=Munch(...))). | |
| 29 | +# | |
| 30 | +# Original idea: https://github.com/Infinidat/munch/blob/2.0.4/README.md#serialization | |
| 31 | +initialization = | |
| 32 | + from munch import Munch | |
| 33 | + Munch.__str__ = lambda self: Munch.toYAML(self, allow_unicode=True, | |
| 34 | + default_flow_style=False) | |
| 35 | + Munch.__repr__ = Munch.__str__ | |
| 24 | 36 | |
| 25 | 37 | [remotes] |
| 26 | 38 | gh = git://github.com/ |
| ... | ... |
Please
register
or
login
to post a comment