swarmsim.yaml.pathlib_representer#

Provides a custom representer for Path objects

swarmsim.yaml.pathlib_representer.represent_path(dumper: Dumper, data: Path)[source]#

Represent a pathlib.Path object as a reconstructable string.

Parameters:
Returns:

str node

Return type:

node

Examples

>>> import swarmsim.yaml
>>> import pathlib as pl
>>> swarmsim.yaml.dump(pl.Path('foo/bar'), sys.stdout)
!!python/object/apply:pathlib.Path
args:
- foo/bar
resolved: /home/username/foo/bar

Functions

represent_path(dumper, data)

Represent a pathlib.Path object as a reconstructable string.