Skip to content

Commit

Permalink
Solve tox fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
knutnergaard committed Nov 20, 2024
1 parent f1021ca commit a499b74
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Lib/fontParts/base/glyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,10 @@ def _get_base_leftMargin(self) -> Optional[IntFloatType]:

def _set_base_leftMargin(self, value: IntFloatType) -> None:
normalizedValue = normalizers.normalizeGlyphLeftMargin(value)
if normalizedValue is not None:
self._set_leftMargin(normalizedValue)
# Avoid mypy conflict with normalizeGlyphLeftMargin -> Optional[IntFloat]
if normalizedValue is None:
raise TypeError("The value for bottomMargin cannot be None.")
self._set_leftMargin(normalizedValue)

def _get_leftMargin(self) -> Optional[IntFloatType]:
"""Get the native glyph's left margin.
Expand Down Expand Up @@ -625,8 +627,10 @@ def _get_base_rightMargin(self) -> Optional[IntFloatType]:

def _set_base_rightMargin(self, value: IntFloatType) -> None:
normalizedValue = normalizers.normalizeGlyphRightMargin(value)
if normalizedValue is not None:
self._set_rightMargin(value)
# Avoid mypy conflict with normalizeGlyphRightMargin -> Optional[IntFloat]
if normalizedValue is None:
raise TypeError("The value for bottomMargin cannot be None.")
self._set_rightMargin(normalizedValue)

def _get_rightMargin(self) -> Optional[IntFloatType]:
"""Get the native glyph's right margin.
Expand Down Expand Up @@ -756,8 +760,10 @@ def _get_base_bottomMargin(self) -> Optional[IntFloatType]:

def _set_base_bottomMargin(self, value: IntFloatType) -> None:
normalizedValue = normalizers.normalizeGlyphBottomMargin(value)
if normalizedValue is not None:
self._set_bottomMargin(value)
# Avoid mypy conflict with normalizeGlyphBottomMargin -> Optional[IntFloat]
if normalizedValue is None:
raise TypeError("The value for bottomMargin cannot be None.")
self._set_bottomMargin(normalizedValue)

def _get_bottomMargin(self) -> Optional[IntFloatType]:
"""Get the native glyph's bottom margin.
Expand Down Expand Up @@ -821,8 +827,10 @@ def _get_base_topMargin(self) -> Optional[IntFloatType]:

def _set_base_topMargin(self, value: IntFloatType) -> None:
normalizedValue = normalizers.normalizeGlyphTopMargin(value)
if normalizedValue is not None:
self._set_topMargin(value)
# Avoid mypy conflict with normalizeGlyphTopMargin -> Optional[IntFloat]
if normalizedValue is None:
raise TypeError("The value for bottomMargin cannot be None.")
self._set_topMargin(normalizedValue)

def _get_topMargin(self) -> Optional[IntFloatType]:
"""Get the native glyph's top margin.
Expand Down

0 comments on commit a499b74

Please sign in to comment.