Skip to content

Great cleanup! #8594

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 7 commits into from
Aug 26, 2022
Merged

Great cleanup! #8594

merged 7 commits into from
Aug 26, 2022

Conversation

sobolevn
Copy link
Member

I've searched for duplicate definitions and removed most of them.
This was a manual job with some help of a new stubtest.

Rules:

  • I haven't touched any magic methods (except a couple of identical __init__)
  • I haven't touched any code with comments
  • I haven't touched untyped code
  • I haven't touched overloads, because they are too hard to read and verify
  • I haven't touched any other advanced stuff

Comment on lines 55 to 56
parentNode: Incomplete
childNodes: Incomplete
Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe also leave the ones that are explicitly marked as Incomplete as they are? Since we've explicitly marked these as "we haven't figured out what they're meant to be yet", they might plausibly have different types in the subclass than in the superclass at runtime.

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to cancel all changes in this file :)
Because after my merge conflict I stopped understanding what is going on.

@github-actions

This comment has been minimized.

@sobolevn
Copy link
Member Author

This error looks like a stubtest bug to me:

error: io.BufferedRandom.seek is inconsistent, stub argument "__offset" differs from runtime argument "target"
Stub: at line 65
def (self: io.IOBase, builtins.int, builtins.int =) -> builtins.int
Runtime:
def (self, target, whence=0, /)

Both types have pos-only parameters, but for some reason they are reported as incompatible.
I will restore these two with a comment for now.

@AlexWaygood
Copy link
Member

This error looks like a stubtest bug to me:

I believe it's actually stubtest working as intended; see python/mypy#13113. I can see both sides of the argument here :-)

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

I haven't rigorously checked the whole thing to see if the signatures on subclasses are identical to the ones on superclasses, but I trust you to have done it properly :)

LGTM, though I'll wait to see if any other maintainers have any thoughts before merging.

@sobolevn
Copy link
Member Author

I trust you to have done it properly

I trust stubtest more than myself here 😆

@github-actions
Copy link
Contributor

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

@sobolevn
Copy link
Member Author

Any other feedback? :)

I think that this PR can quickly have merge conflicts and this will require some time to re-think.

@AlexWaygood AlexWaygood requested a review from srittau August 24, 2022 17:36
Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Not checked this in depth, either, but the passing tests give me confidence.

@srittau srittau merged commit 0259068 into python:master Aug 26, 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.

3 participants