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

Tighten up some internal type annotations #3395

Closed
wants to merge 2 commits into from

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Jul 4, 2022

Primarily enabling Mypy's strict-equality check, plus a few other clarifying annotations while I was going through.

@Zac-HD Zac-HD added the internals Stuff that only Hypothesis devs should ever see label Jul 4, 2022
@Zac-HD Zac-HD requested a review from DRMacIver as a code owner July 4, 2022 01:50
@Zac-HD
Copy link
Member Author

Zac-HD commented Jul 4, 2022

Folded into #3396.

@Zac-HD Zac-HD closed this Jul 4, 2022
Comment on lines +18 to +21
try:
from typing import TypeAlias
except ImportError:
TypeAlias = object # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid the pyright fail case I think you want to fall back on TypeAlias being Any:

try:
    from typing import TypeAlias
except ImportError:
    try:
        from typing_extensions import TypeAlias
    except ImportError:
        from typing import Any as TypeAlias

Copy link
Member Author

Choose a reason for hiding this comment

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

The fix I went with was "instead of moving the Real alias, just use SupportsFloat like a sensible person"; see the other PR for that 😁

Copy link
Contributor

@rsokl rsokl Jul 4, 2022

Choose a reason for hiding this comment

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

The fix I went with was "instead of moving the Real alias, just use SupportsFloat like a sensible person"; see the other PR for that 😁

🤩

I am sooooo stealing this for some of my projects!

@Zac-HD Zac-HD deleted the stricter-mypy branch July 4, 2022 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Stuff that only Hypothesis devs should ever see
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants