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

Fix MyPy's view of _ModuleMeta #822

Merged
merged 1 commit into from
Aug 31, 2024

Conversation

NeilGirdhar
Copy link
Contributor

No description provided.

@patrick-kidger
Copy link
Owner

patrick-kidger commented Aug 29, 2024

The downside of this approach is that it means we lose type-checking within the definition of _ModuleMeta itself.

Would something like the following work instead?

# As today, but the name has an additional underscore
class __ModuleMeta(ABCMeta):
    ...

if TYPE_CHECKING:
    class _ModuleMeta: ...  # as today
else:
    _ModuleMeta = __ModuleMeta

?

@NeilGirdhar
Copy link
Contributor Author

Yup, that's a good idea!

@patrick-kidger
Copy link
Owner

Looks like tests are failing (due to something to do with name mangling). Other than that, LGTM!

@NeilGirdhar NeilGirdhar force-pushed the fix_mypy branch 2 times, most recently from 8abe260 to 3f41f71 Compare August 31, 2024 05:01
@NeilGirdhar
Copy link
Contributor Author

Fixes #820

@patrick-kidger patrick-kidger merged commit 3cdeef8 into patrick-kidger:main Aug 31, 2024
2 checks passed
@patrick-kidger
Copy link
Owner

Wonderful stuff. LGTM, and merged!

@NeilGirdhar NeilGirdhar deleted the fix_mypy branch August 31, 2024 11:10
@patrick-kidger patrick-kidger mentioned this pull request Sep 14, 2024
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