Skip to content

Commit

Permalink
Resolve mypy errors. (#794)
Browse files Browse the repository at this point in the history
* Resolve `mypy` errors.

---------

Co-authored-by: knutnergaard <knutnergaard@users.noreply.github.com>
  • Loading branch information
knutnergaard and knutnergaard authored Nov 29, 2024
1 parent 0bb02b4 commit e02cd58
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
1 change: 1 addition & 0 deletions Lib/fontParts/base/bPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
PairType,
PairCollectionType,
SextupleCollectionType,
IntFloatType,
)

if TYPE_CHECKING:
Expand Down
9 changes: 6 additions & 3 deletions Lib/fontParts/base/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,17 @@ def _transformBy(

compatibilityReporterClass = ContourCompatibilityReporter

def isCompatible(self, other: BaseContour) -> Tuple[bool, str]:
def isCompatible(
self, other: BaseContour
) -> Tuple[bool, ContourCompatibilityReporter]:
"""Evaluate interpolation compatibility with another contour.
:param other: The other :class:`BaseContour` instance to check
compatibility with.
:return: A :class:`tuple` where the first element is a :class:`bool`
indicating compatibility, and the second element is a :class:`str`
of compatibility notes.
indicating compatibility, and the second element is
a :class:`fontParts.base.compatibility.ContourCompatibilityReporter`
instance.
Example::
Expand Down
6 changes: 3 additions & 3 deletions Lib/fontParts/base/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ def _interpolate(

compatibilityReporterClass = FontCompatibilityReporter

def isCompatible(self, other: BaseFont) -> Tuple[bool, str]:
def isCompatible(self, other: BaseFont) -> Tuple[bool, FontCompatibilityReporter]:
"""Evaluate interpolation compatibility with another font.
This method will return a :class:`bool` indicating if the font is
Expand All @@ -2068,8 +2068,8 @@ def isCompatible(self, other: BaseFont) -> Tuple[bool, str]:
:param other: The other :class:`BaseFont` instance to check
compatibility with.
:return: A :class:`tuple` where the first element is a :class:`bool`
indicating compatibility, and the second element is a :class:`str`
of compatibility notes.
indicating compatibility, and the second element is
a :class:`fontParts.base.compatibility.FontCompatibilityReporter` instance.
Example::
Expand Down
7 changes: 4 additions & 3 deletions Lib/fontParts/base/glyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2795,14 +2795,15 @@ def _checkPairs(
reporter.warning = True
reporterObject.append(compatibility)

def isCompatible(self, other: BaseGlyph) -> Tuple[bool, str]:
def isCompatible(self, other: BaseGlyph) -> Tuple[bool, GlyphCompatibilityReporter]:
"""Evaluate interpolation compatibility with another glyph.
:param other: The other :class:`BaseGlyph` instance to check
compatibility with.
:return: A :class:`tuple` where the first element is a :class:`bool`
indicating compatibility, and the second element is a :class:`str`
of compatibility notes.
indicating compatibility, and the second element is
a :class:`fontParts.base.compatibility.GlyphCompatibilityReporter`
instance.
"""
return super(BaseGlyph, self).isCompatible(other, BaseGlyph)
Expand Down
9 changes: 5 additions & 4 deletions Lib/fontParts/base/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,14 +1075,15 @@ def _interpolate(

compatibilityReporterClass = LayerCompatibilityReporter

def isCompatible(self, other: BaseLayer) -> tuple[bool, str]:
def isCompatible(self, other: BaseLayer) -> Tuple[bool, LayerCompatibilityReporter]:
"""Evaluate interpolation compatibility with another layer.
:param other: The other :class:`BaseLayer` instance to check
compatibility with.
:return: A :class:`tuple` where the first element is a :class:`bool`
indicating compatibility, and the second element is a :class:`str`
of compatibility notes.
indicating compatibility, and the second element is
a :class:`fontParts.base.compatibility.LayerCompatibilityReporter`
instance.
Example::
Expand All @@ -1098,7 +1099,7 @@ def isCompatible(self, other: BaseLayer) -> tuple[bool, str]:
return super(BaseLayer, self).isCompatible(other, BaseLayer)

def _isCompatible(
self, other: BaseLib, reporter: LayerCompatibilityReporter
self, other: BaseLayer, reporter: LayerCompatibilityReporter
) -> None:
"""Evaluate interpolation compatibility with another native layer.
Expand Down
9 changes: 6 additions & 3 deletions Lib/fontParts/base/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ def _transformBy(self, matrix: SextupleCollectionType[IntFloatType], **kwargs: A

compatibilityReporterClass = SegmentCompatibilityReporter

def isCompatible(self, other: BaseSegment) -> Tuple[bool, str]:
def isCompatible(
self, other: BaseSegment
) -> Tuple[bool, SegmentCompatibilityReporter]:
"""Evaluate interpolation compatibility with another segment.
This method will return a :class:`bool` indicating if the segment is
Expand All @@ -623,8 +625,9 @@ def isCompatible(self, other: BaseSegment) -> Tuple[bool, str]:
:param other: The other :class:`BaseSegment` instance to check
compatibility with.
:return: A :class:`tuple` where the first element is a :class:`bool`
indicating compatibility, and the second element is a :class:`str`
of compatibility notes.
indicating compatibility, and the second element is
a :class:`fontParts.base.compatibility.SegmentCompatibilityReporter`
instance.
Example::
Expand Down

0 comments on commit e02cd58

Please sign in to comment.