Skip to content

Commit

Permalink
Allow a raw int instead of PointType to be unstructured
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Dec 7, 2023
1 parent 0a9f3de commit ca8a2ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fontra/core/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def _structurePointType(v, tp):
return PointType(v)


def _unstructurePointType(v):
return int(v)


_cattrsConverter = cattrs.Converter()

_cattrsConverter.register_structure_hook(Union[PackedPath, Path], _structurePath)
Expand All @@ -230,6 +234,7 @@ def _structurePointType(v, tp):
_cattrsConverter.register_unstructure_hook(Point, _unstructurePoint)
_cattrsConverter.register_structure_hook(bool, lambda x, y: x)
_cattrsConverter.register_structure_hook(PointType, _structurePointType)
_cattrsConverter.register_unstructure_hook(PointType, _unstructurePointType)


def registerOmitDefaultHook(cls):
Expand Down

0 comments on commit ca8a2ce

Please sign in to comment.