mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-22 21:25:43 -05:00
dictscheme: fix type hinting
This commit is contained in:
parent
a0c4036390
commit
2e504b7b00
1 changed files with 5 additions and 2 deletions
|
@ -52,7 +52,7 @@ class DictScheme(Munch):
|
||||||
_sparse: ClassVar[bool] = False
|
_sparse: ClassVar[bool] = False
|
||||||
|
|
||||||
def __init__(self, d: Mapping = {}, validate: bool = True, **kwargs):
|
def __init__(self, d: Mapping = {}, validate: bool = True, **kwargs):
|
||||||
self.update(d | kwargs, validate=validate)
|
self.update(dict(d) | kwargs, validate=validate)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def transform(
|
def transform(
|
||||||
|
@ -269,10 +269,13 @@ class DictScheme(Munch):
|
||||||
) -> str:
|
) -> str:
|
||||||
import yaml
|
import yaml
|
||||||
yaml_args = {'sort_keys': False} | yaml_args
|
yaml_args = {'sort_keys': False} | yaml_args
|
||||||
return yaml.dump(
|
dumped = yaml.dump(
|
||||||
self.toDict(strip_hidden=strip_hidden, sparse=sparse),
|
self.toDict(strip_hidden=strip_hidden, sparse=sparse),
|
||||||
**yaml_args,
|
**yaml_args,
|
||||||
)
|
)
|
||||||
|
if dumped is None:
|
||||||
|
raise Exception(f"Failed to yaml-serialse {self}")
|
||||||
|
return dumped
|
||||||
|
|
||||||
def toToml(
|
def toToml(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Add table
Reference in a new issue