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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update await_maybe #1505

Merged
merged 1 commit into from
Dec 20, 2021
Merged

Conversation

Apakottur
Copy link
Contributor

@Apakottur Apakottur commented Dec 20, 2021

Replace iscoroutine with isawaitable in await_maybe towards the update to mypy 0.920.

Details

We are currently on version 0.910 of mypy, and are working towards updating to 0.920 in #1503.

In the new mypy version we get the following error in await_maybe:

strawberry/utils/await_maybe.py:12: error: Incompatible types in "await" (actual type "CoroutineType", expected type "Awaitable[Any]")

This PR modifies the function to use isawaitable instead of iscorotuine, which fixes the error.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@botberry
Copy link
Member

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


This release modifies the internal utility function await_maybe towards updating mypy to 0.920.


Here's the preview release card for twitter:

Here's the tweet text:

🆕 Release (next) is out! Thanks to Yossi Rozantsev for the PR 👏

Get it here 👉 https://github.com/strawberry-graphql/strawberry/releases/tag/(next)

Copy link
Member

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'm going to double check the difference between iscoroutine and isawaitable and then approve the PR[1] 😊

[1] there's also asyncio.iscoroutine so I'm a bit confused and what to make sure we use the right check :)

@codecov
Copy link

codecov bot commented Dec 20, 2021

Codecov Report

Merging #1505 (16f174d) into main (b0533e4) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1505   +/-   ##
=======================================
  Coverage   98.11%   98.11%           
=======================================
  Files         128      128           
  Lines        4396     4396           
  Branches      746      746           
=======================================
  Hits         4313     4313           
  Misses         43       43           
  Partials       40       40           

Copy link
Member

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@@ -8,7 +8,7 @@


async def await_maybe(value: AwaitableOrValue):
if inspect.iscoroutine(value):
if inspect.isawaitable(value):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrick91 patrick91 merged commit 8896e13 into strawberry-graphql:main Dec 20, 2021
@botberry
Copy link
Member

Thanks for contributing to Strawberry! 🎉 You've been invited to join
the Strawberry GraphQL organisation 😊

You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67

And don't forget to join our discord server: https://strawberry.rocks/discord 🔥

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