Also make deserialization robust against bools

This commit is contained in:
Kovid Goyal 2025-08-15 12:09:01 +05:30
parent a8de8e45b0
commit 3fbdeedfa7
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -76,7 +76,8 @@ def __init__(self, data: dict[str, str]):
self.bias = int(data.get('bias', 50))
except Exception:
self.bias = 50
self.mirrored = to_bool(data.get('mirrored', 'false'))
rv: bool | str = data.get('mirrored', 'false')
self.mirrored = to_bool(rv) if isinstance(rv, str) else bool(rv)
def serialized(self) -> dict[str, Any]:
return {'full_size': self.full_size, 'bias': self.bias, 'mirrored': 'y' if self.mirrored else 'n'}