-
Notifications
You must be signed in to change notification settings - Fork 479
Annotate ufoLib #3875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Annotate ufoLib #3875
Conversation
b01c057
to
85d8e10
Compare
85d8e10
to
8a7b2dd
Compare
@anthrotype @madig I'm running into a type mismatch between the class UFOReader(_UFOBaseIO):
def _upConvertKerning(self, validate: bool) -> None:
if self._upConvertedKerningData:
...
else:
...
# convert kerning and groups
kerning, groups, conversionMaps = convertUFO1OrUFO2KerningToUFO3Kerning(
self._upConvertedKerningData["originalKerning"],
deepcopy(self._upConvertedKerningData["originalGroups"]),
self.getGlyphSet(),
) Should the last argument in the call to |
|
@jenskutilek I see, but this means that the last argument in the call should be |
The point of this argument is membership testing.
8000
This works for sets, dicts and lists (although porentially not efficiently for the latter), as well as anything that implements |
I Take it you mean If using such a strict annotation, we'll need to cast the Correction: Off course, dicts can be coerced to sets, so it's a bit simpler than the above, but I'm not sure that's what we should do. |
fonttools/Lib/fontTools/ufoLib/glifLib.py Lines 565 to 568 in 75af368
|
@jenskutilek As you suspect, |
No I do not. We don't want the concrete type https://docs.python.org/3/library/typing.html#typing.Set says:
|
Maybe |
Thanks, You're absolutely right! My brain was stuck on Python 3.8. |
@justvanrossum There is always |
This comment was marked as duplicate.
This comment was marked as duplicate.
Ah yes, that’s the perfect one for this argument. |
@@ -597,7 +631,9 @@ def getUnicodes(self, glyphNames=None): | |||
unicodes[glyphName] = _fetchUnicodes(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text
is defined as bytes
while _fetchUnicodes
expects str
. Not sure how to solve this.
@@ -612,7 +648,9 @@ def getComponentReferences(self, glyphNames=None): | |||
components[glyphName] = _fetchComponentBases(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See line 631.
Didn't bother with the deprecated |
Still a few kinks to iron out. Reconverting to draft. |
All Mypy checks and tests passing. |
No description provided.