Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃彿 Add type overloads for get_execution_result #287

Conversation

connorbrinton
Copy link
Contributor

Methods like execute were previously annotated with a Union type, indicating all of the types of return values that the function could be returned. However, a more specific return type can often be inferred statically based on whether or not the get_execution_result keyword argument is passed to the method.

These changes add function type overloads to methods accepting the get_execution_result keyword, which allows Mypy to infer a more specific return type based on the passed value of get_execution_result, if any.

Methods like `execute` were previously annotated with a `Union` type,
indicating all of the types of return values that the function could be
returned. However, a more specific return type can often be inferred
statically based on whether or not the `get_execution_result` keyword
argument is passed to the method.

These changes add function type overloads to methods accepting the
`get_execution_result` keyword, which allows Mypy to infer a more
specific return type based on the passed value of
`get_execution_result`, if any.
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2022

Codecov Report

Merging #287 (64beee3) into master (6b51742) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #287   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         2045      2060   +15     
=========================================
+ Hits          2045      2060   +15     
Impacted Files Coverage 螖
gql/client.py 100.00% <100.00%> (酶)

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 6b51742...64beee3. Read the comment docs.

gql/client.py Outdated Show resolved Hide resolved
gql/compat.py Outdated Show resolved Hide resolved
@leszekhanusz
Copy link
Collaborator

Thanks for your PR!

Note: tests are flaky on windows for unrelated reasons. I'll verify this and probably disable this test for windows.

@connorbrinton
Copy link
Contributor Author

@leszekhanusz You bet, thanks for tidying it up and maintaining gql! 馃槃

@leszekhanusz leszekhanusz merged commit 5440c6c into graphql-python:master Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants