[change] API - Add type annotations to api module#2754
Merged
liiight merged 1 commit intoFlexget:developfrom Nov 28, 2020
Merged
[change] API - Add type annotations to api module#2754liiight merged 1 commit intoFlexget:developfrom
liiight merged 1 commit intoFlexget:developfrom
Conversation
c665aa6 to
d186330
Compare
liiight
requested changes
Nov 5, 2020
Member
liiight
left a comment
There was a problem hiding this comment.
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
Member
There was a problem hiding this comment.
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
Contributor
Author
|
branch rebased to latest develop, requested changes performed |
liiight
approved these changes
Nov 28, 2020
Member
|
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):