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

Cleanup @property stuff on BaseRemoteEndpoint #136

Conversation

pipermerriam
Copy link
Member

@pipermerriam pipermerriam commented Jun 13, 2019

What was wrong?

There were some errors in the implementation that needed cleaning up

How was it fixed?

Fixed them (need to add tests)

Cute Animal Picture

6a010535647bf3970b0105367c839d970b-800wi

@pipermerriam pipermerriam marked this pull request as ready for review June 13, 2019 17:26
@pipermerriam pipermerriam changed the title [WIP] Cleanup @property stuff on BaseRemoteEndpoint Cleanup @property stuff on BaseRemoteEndpoint Jun 13, 2019
def is_running(self) -> bool:
return not self.is_stopped and self.running.is_set()
return not self.is_stopped and self._running.is_set()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm really confused by this. How is it possible that neither mypy nor flake8 caught this?

Copy link
Member Author

Choose a reason for hiding this comment

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

In my local env. just pushed something to see if CI catches it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it seems it catches it after this change but not on current master which is really weird. Also, the @property decorators also need to be applied on the RemoteEndpointAPI.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, as soon as you remove the @property from is_stopped it won't catch this error anymore. This feels like a weird mypy bug to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's very odd.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, here is a minimal test case.

class TestCase:

    def foo(self) -> bool:
        return False and self.meh()

This is not caught by mypy. Do you think this is expected behavior?

Copy link
Contributor

Choose a reason for hiding this comment

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

I opened an issue against mypy python/mypy#6990

@pipermerriam pipermerriam force-pushed the piper/cleanup-RemoteEndpoint-properties branch from cd08697 to 42ec907 Compare June 13, 2019 19:20
@pipermerriam pipermerriam merged commit 235589e into ethereum:master Jun 13, 2019
@pipermerriam pipermerriam deleted the piper/cleanup-RemoteEndpoint-properties branch June 13, 2019 19:38
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.

None yet

2 participants