-
Notifications
You must be signed in to change notification settings - Fork 478
[change] API - Add type annotations to api module #2754
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
c665aa6 to
d186330
Compare
liiight
left a comment
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.
Holy crap dude, you put in a TON of work on this, thank you!
I wonder if we should add type testing to the CI/pre-commit.
@gazpachoking @paranoidi WDYT?
flexget/api/core/plugins.py
Outdated
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.
type shouldn't be None, it's Session. last one i'll mention :)
d186330 to
f64856d
Compare
f64856d to
a899fba
Compare
a899fba to
9e68a29
Compare
|
branch rebased to latest develop, requested changes performed |
|
Absolutely amazing work on this @vgerak !!! |
|
@vgerak I noticed you referenced python/typing#193 on variadic generics in this thread. Heads up that we've been working on a draft of a PEP for this in PEP 646. If this is something you still care about, take a read and let us know any feedback in this thread in typing-sig. Thanks! |
Motivation for changes:
Continuation of #2751,
apimoduleDetailed changes:
pagination_headers()(equivalent results, obviously). To me, it's more readable compared to the template parameter replacement method, but, as it's just my opinion, I can revert it if you wishTypedDictusage is wrapped insideif TYPE_CHECKINGblocks, as it's available on versions >= 3.8.Sessionannotation for API methods introduced "new" mypy warnings like the following (previously ignored, as inferred type wasAnycause of missing annotations):Item "None" of "Optional[Session]" has no attribute "query"Should all go away when typing decorators that mess with the arguments is implemented. Relevant issues: Allow variadic generics python/typing#193 , Support function decorators excellently python/mypy#3157
try: ... except Exception: passto usecontextlib.suppressinsteadLog and/or tests output (preferably both):