Skip to content

Remove empty __init__ methods #8816

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

Merged
merged 2 commits into from
Sep 30, 2022
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Sep 30, 2022

I've removed all def __init__(self) definitions if they are:

  • Defined in a class that inherits directly from object, like TaskGroup
  • Or defined in a class that inherits from other classes with no custom __init__ set, like PidfdChildWatcher
  • Is not used as a part of @overload

They are not needed, because object already provides this method.
Keeping the stubs minimal is better for future maintenance.

There are some complex cases that I've left for now like stdlib/xml/dom/minidom.pyi, because it is not fully annotated yet.

Refs #8594

@sobolevn
Copy link
Member Author

Stubtest fails with:

note: unused allowlist entry _csv.Dialect.__init__
note: unused allowlist entry queue.SimpleQueue.__init__
note: unused allowlist entry select.kqueue.__init__

Looking into it.

@github-actions

This comment has been minimized.

@sobolevn
Copy link
Member Author

Ok, I removed from this PR all three cases that are listed in allowlists.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit 380022c into python:master Sep 30, 2022
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