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

Use mypy recommended conditional imports for compats #154

Merged
merged 1 commit into from
Sep 16, 2023

Conversation

adferrand
Copy link

@adferrand adferrand commented Sep 14, 2023

Hello !

Concerning conditional imports based on the actual Python version at runtime, Mypy recommendation is to explicitly use sys.version_info to trigger the relevant import depending on the Python version.

Reference to the documentation: https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks

I apply this approach to the compat module.

As a consequence, Mypy does an educated guess on the imports, and #type: ignore inline comment is not needed anymore.

@kislyuk kislyuk merged commit 66e95a0 into pyauth:develop Sep 16, 2023
@kislyuk
Copy link
Member

kislyuk commented Sep 16, 2023

Thanks! Did not know that, will use from now on.

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.

2 participants