示例#1
0
文件: yaml.py 项目: khardix/mccurse
def path_representer(dumper: Dumper, path: Path) -> yaml.Node:
    """Custom representer for Path objects in YAML."""
    return dumper.represent_scalar(STR_TAG, str(path))
示例#2
0
文件: yaml.py 项目: khardix/mccurse
def timestamp_representer(dumper: Dumper, date: datetime) -> yaml.Node:
    """Custom representer for datetime objects in YAML."""
    return dumper.represent_scalar(TIMESTAMP_TAG, date.isoformat())