add repo.libs.faults.dict_as_toml
This commit is contained in:
parent
1d5bcf74c0
commit
773e8d118f
11 changed files with 16 additions and 34 deletions
|
@ -1,7 +1,10 @@
|
|||
from json import dumps, loads
|
||||
|
||||
from tomlkit import dumps as toml_dumps
|
||||
|
||||
from bundlewrap.metadata import metadata_to_json
|
||||
from bundlewrap.utils import Fault
|
||||
from bundlewrap.utils.text import toml_clean
|
||||
|
||||
|
||||
def resolve_faults(dictionary: dict) -> dict:
|
||||
|
@ -45,3 +48,11 @@ def dict_as_json(json):
|
|||
lambda o: metadata_to_json(o) + '\n',
|
||||
o=json
|
||||
)
|
||||
|
||||
|
||||
def dict_as_toml(toml):
|
||||
return Fault(
|
||||
'dict_as_toml',
|
||||
lambda o: toml_clean(toml_dumps(resolve_faults(o), sort_keys=True)) + '\n',
|
||||
o=toml
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue