-
Notifications
You must be signed in to change notification settings - Fork 476
Add typing info to plistlib #2061
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
Conversation
That singledispatch register section is pretty disgusting. I find this a high price to pay. |
Indeed, and it doesn't even pacify Pylance. Not quite sure what to do here
yet.
|
I think we can, it was there for backward compatibility with old python2 plistlib API |
could these https://github.com/JelleZijlstra/lxml-stubs help maybe? |
Lib/fontTools/misc/plistlib.py
Outdated
import sys | ||
import re | ||
from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, Tuple, Union, overload | ||
from typing import Any, Callable, Dict, List, Mapping, NoReturn, Optional, Sequence, Tuple, Type, TypeVar, Union, overload, IO |
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.
(perhaps the PR is unfinished but) I see two almost duplicated from typing import *
lines above.
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.
Yeah, I'll clean up later. Still fudging about between random support requests.
Btw, do we really need |
https://github.com/python/cpython/blob/a0da90720d5330c53b8083272374ede1c7a1e33a/Lib/plistlib.py#L973 I wouldn't like to lose it because of too strict/lazy typecheckers |
Ugh. The |
6c76ea5
to
a364cff
Compare
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.
overall, lgtm (with comments)
Should you not use "PlistEncodable"
instead of Any
where you use Mapping[str, Any]
or Sequence[Any]
?
ah :( |
Ok, I think this is it for now. @anthrotype so, I put in four type-ignores and three of them are for |
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.
overall LGTM.
pls fix ImportError in ufoLib.plistlib (see Travis CI error)
0f2b8be
to
2906ac2
Compare
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
Wherein I spend my life adding typing information to the plistlib module and use Pylance in strict checking mode. Maybe I'll get somewhere.
First boss: microsoft/pyright#988
I wish I could just kill
Data
.The module is half red because the
etree
module could do with some typing information, too.@chrissimpkins hi there