diff --git a/src/ufoLib2/objects/image.py b/src/ufoLib2/objects/image.py index 8cd1ad22..e6aec9a9 100644 --- a/src/ufoLib2/objects/image.py +++ b/src/ufoLib2/objects/image.py @@ -3,18 +3,19 @@ from ufoLib2.objects.misc import Transformation -def _to_optional_transformation(v): - if v is not None and not isinstance(v, Transformation): +def _to_transformation(v): + if not isinstance(v, Transformation): return Transformation(*v) + return v @attr.s(slots=True) class Image(object): fileName = attr.ib(default=None, type=Optional[str]) _transformation = attr.ib( - default=None, - convert=_to_optional_transformation, - type=Optional[Transformation], + default=Transformation(), + convert=_to_transformation, + type=Transformation, ) color = attr.ib(default=None, type=Optional[str]) @@ -24,7 +25,7 @@ def transformation(self): @transformation.setter def transformation(self, value): - self._transformation = _to_optional_transformation(value) + self._transformation = _to_transformation(value) def clear(self): self.fileName = None