diff options
| author | Yuval Adam <_@yuv.al> | 2024-05-09 13:09:52 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2024-05-09 13:09:52 +0200 |
| commit | 7a90e3dde344f86cf4587035713984f78f5b41d0 (patch) | |
| tree | 51174cb2326c1defb0c13895984190ec5dc125b5 | |
| parent | d089e3acb34cf3214c4c1a52b3142798de5f92f2 (diff) | |
Allow unicode in yaml dump
| -rw-r--r-- | ymlstash/stash.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ymlstash/stash.py b/ymlstash/stash.py index b8f95d5..f2d100c 100644 --- a/ymlstash/stash.py +++ b/ymlstash/stash.py @@ -6,7 +6,14 @@ from pathlib import Path class YmlStash: - def __init__(self, model, path, file_suffix="yml", unsafe=False, filter_none=False): + def __init__( + self, + model, + path, + file_suffix="yml", + unsafe=False, + filter_none=False, + ): self.model = model self.path = Path(path) self.file_suffix = f".{file_suffix}" @@ -44,7 +51,14 @@ class YmlStash: obj_dict = asdict(obj) if self.filter_none: obj_dict = {k: v for (k, v) in obj_dict.items() if v is not None} - f.write(yaml.dump(obj_dict, default_flow_style=False, sort_keys=False)) + f.write( + yaml.dump( + obj_dict, + allow_unicode=True, + default_flow_style=False, + sort_keys=False, + ) + ) def delete(self, key): try: |
