Pretty-printing function that can pretty-print OrderedDicts like regular dictionaries. Useful for printing the output of :meth:`marshmallow.Schema.dump`. .. deprecated:: 3.7.0 marshmallow.pprint will be removed in marshmallow 4.
(obj, *args, **kwargs)
| 75 | |
| 76 | |
| 77 | def pprint(obj, *args, **kwargs) -> None: |
| 78 | """Pretty-printing function that can pretty-print OrderedDicts |
| 79 | like regular dictionaries. Useful for printing the output of |
| 80 | :meth:`marshmallow.Schema.dump`. |
| 81 | |
| 82 | .. deprecated:: 3.7.0 |
| 83 | marshmallow.pprint will be removed in marshmallow 4. |
| 84 | """ |
| 85 | warnings.warn( |
| 86 | "marshmallow's pprint function is deprecated and will be removed in marshmallow 4.", |
| 87 | RemovedInMarshmallow4Warning, |
| 88 | stacklevel=2, |
| 89 | ) |
| 90 | if isinstance(obj, collections.OrderedDict): |
| 91 | print(json.dumps(obj, *args, **kwargs)) |
| 92 | else: |
| 93 | py_pprint(obj, *args, **kwargs) |
| 94 | |
| 95 | |
| 96 | # https://stackoverflow.com/a/27596917 |
no test coverage detected
searching dependent graphs…