From a1dd15f6018c2ccdf065880104faa4068b306285 Mon Sep 17 00:00:00 2001 From: knutnergaard Date: Tue, 25 Feb 2025 21:49:24 +0100 Subject: [PATCH] Fix `mypy` errors. --- Lib/fontParts/base/features.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/fontParts/base/features.py b/Lib/fontParts/base/features.py index d52f82aa..b11db571 100644 --- a/Lib/fontParts/base/features.py +++ b/Lib/fontParts/base/features.py @@ -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 @@ -32,7 +32,7 @@ def _reprContents(self) -> List[str]: # Font - _font: Optional[BaseFont] = None + _font: Optional[Callable[[], BaseFont]] = None font: dynamicProperty = dynamicProperty( "font", @@ -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"