Skip to content

Commit

Permalink
fix Variable leads to error in dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiyuanChen committed Nov 4, 2022
1 parent eebcc6d commit 1ce63df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chanfig/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def to(self, cls: Callable): # pylint: disable=C0103
```
"""

self.storage[0] = cls(self.storage[0])
self.value = cls(self.value)
return self

def int(self) -> int:
Expand Down Expand Up @@ -667,7 +667,7 @@ def to(self, cls: Callable = dict) -> Mapping: # pylint: disable=C0103
```
"""

return cls(**self)
return cls(**{k: v.value if isinstance(v, Variable) else v for k, v in self.items()})

convert = to
dict = to
Expand Down

0 comments on commit 1ce63df

Please sign in to comment.