Skip to content

Commit

Permalink
Fix mypy errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
knutnergaard committed Feb 25, 2025
1 parent dce3549 commit a1dd15f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/fontParts/base/features.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Tuple, List, Optional
from typing import TYPE_CHECKING, Callable, Tuple, List, Optional, Union

from fontParts.base.base import BaseObject, dynamicProperty, reference
from fontParts.base import normalizers
Expand Down Expand Up @@ -32,7 +32,7 @@ def _reprContents(self) -> List[str]:

# Font

_font: Optional[BaseFont] = None
_font: Optional[Callable[[], BaseFont]] = None

font: dynamicProperty = dynamicProperty(
"font",
Expand All @@ -58,7 +58,9 @@ def _get_font(self) -> Optional[BaseFont]:
return None
return self._font()

def _set_font(self, font: Optional[BaseFont]) -> None:
def _set_font(
self, font: Optional[Union[BaseFont, Callable[[], BaseFont]]]
) -> None:
if self._font is not None and self._font() != font:
raise AssertionError(
"font for features already set and is not same as font"
Expand Down

0 comments on commit a1dd15f

Please sign in to comment.