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

chore: Use typing.TYPE_CHECKING instead of MYPY #1503

Merged
merged 2 commits into from
Jun 4, 2023

Conversation

rapsealk
Copy link
Contributor

Hello graphene!

I found that the code base is using MYPY as a constant to tell whether a type checker is running.

According to the mypy docs, however, mypy introduces a more commonly used constant: typing.TYPE_CHECKING. So I'd like to suggest using this rather than MYPY.

As typing.TYPE_CHECKING has been added since Python 3.5.2 and graphene supports from Python 3.6, there would be no problem with backporting.

Reference:

@codecov
Copy link

codecov bot commented Jun 4, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c636d98) 96.01% compared to head (9b41db2) 96.01%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1503   +/-   ##
=======================================
  Coverage   96.01%   96.01%           
=======================================
  Files          51       51           
  Lines        1755     1755           
=======================================
  Hits         1685     1685           
  Misses         70       70           
Impacted Files Coverage Δ
graphene/types/inputobjecttype.py 97.50% <100.00%> (ø)
graphene/types/interface.py 93.33% <100.00%> (ø)
graphene/types/mutation.py 92.45% <100.00%> (ø)
graphene/types/objecttype.py 93.61% <100.00%> (ø)
graphene/types/union.py 91.30% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@erikwrede
Copy link
Member

Thanks! 😊

@erikwrede erikwrede merged commit d77d0b0 into graphql-python:master Jun 4, 2023
9 checks passed
@rapsealk rapsealk deleted the fix-type-checking-flag branch June 4, 2023 21:49
@rapsealk rapsealk changed the title fix: Use typing.TYPE_CHECKING to provide generalized way chore: Use typing.TYPE_CHECKING instead of MYPY Jun 5, 2023
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

2 participants