mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
![pre-commit-ci[bot]](/assets/img/avatar_default.png)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
20 lines
457 B
Python
20 lines
457 B
Python
"""Custom tools for managing JSON serialization / deserialization of xonsh
|
|
objects.
|
|
"""
|
|
|
|
import functools
|
|
|
|
from xonsh.tools import EnvPath
|
|
|
|
|
|
@functools.singledispatch
|
|
def serialize_xonsh_json(val):
|
|
"""JSON serializer for xonsh custom data structures. This is only
|
|
called when another normal JSON types are not found.
|
|
"""
|
|
return str(val)
|
|
|
|
|
|
@serialize_xonsh_json.register(EnvPath)
|
|
def _serialize_xonsh_json_env_path(val):
|
|
return val.paths
|