1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 08:33:49 +00:00

toml: move from toml to tomllib + tomli_w

* toml is getting removed from distributions due to being generally
  unmaintained and not support the lastest TOML standard.
* For parsing use tomllib which is included in python3.11 and tomli for
  earlier interpeter versions.
* For writing use tomli-w. tomli-w.dump() expects bytes-like objects so
  work around it to keep compatability and minimize changes elsewhere.

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate
2023-08-03 17:43:09 +03:00
committed by deadc0de
parent af5bcf4514
commit 56d5a86eb2
7 changed files with 31 additions and 14 deletions

View File

@@ -9,8 +9,8 @@ convert yaml config file to toml
import sys
# pip3 install ruamel.yaml
from ruamel.yaml import YAML as yaml
# pip3 install toml
import toml
# pip3 install tomli_w
import tomli_w
def yaml_load(path):
@@ -42,7 +42,7 @@ def replace_none(content):
def toml_dump(content):
"""dump toml to stdout"""
return toml.dumps(content)
return tomli_w.dumps(content)
# pylint: disable=C0103