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(core): get_children with include_data=True uses GetChildren2 types #515

Merged
merged 3 commits into from
Oct 8, 2018

Conversation

saffroy
Copy link
Contributor

@saffroy saffroy commented Jul 17, 2018

Closes #514

@@ -380,7 +381,8 @@ def _read_response(self, header, buffer, offset):
# Determine if watchers should be registered
watcher = getattr(request, 'watcher', None)
if not client._stopped.is_set() and watcher:
if isinstance(request, GetChildren):
if (isinstance(request, GetChildren)
or isinstance(request, GetChildren2)):

Choose a reason for hiding this comment

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

visually indented line with same indent as next logical line

Copy link
Member

@jeffwidman jeffwidman Oct 8, 2018

Choose a reason for hiding this comment

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

@saffroy FYI isinstance() can take multiple classes as a tuple, so that'd be the easiest way to clean this up:

if isinstance(request, (GetChildren, GetChildren2)):

Details: https://stackoverflow.com/a/33311330/770425

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that should do. And I learned something!

jeffwidman
jeffwidman previously approved these changes Sep 25, 2018
Copy link
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -380,7 +381,8 @@ def _read_response(self, header, buffer, offset):
# Determine if watchers should be registered
watcher = getattr(request, 'watcher', None)
if not client._stopped.is_set() and watcher:
if isinstance(request, GetChildren):
if (isinstance(request, GetChildren)
Copy link
Member

Choose a reason for hiding this comment

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

@saffroy do you know if GetChildren is even used? Or is it always GetChildren2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AIUI both are used: GetChildren2 when (at the get_children API level) we request data in the response, GetChildren otherwise.

So, what's unclear to me is how to best please the linter here without degrading the code. Maybe separate into two if statements that branch to identical statements? Doesn't look quite right to me, but I don't care that much.

Copy link
Member

@jeffwidman jeffwidman Oct 8, 2018

Choose a reason for hiding this comment

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

Ah, that makes sense re GetChildren2 vs GetChildren.

There's a straightforward way to fix this linting issue, I overlooked it previously, so I'll leave a comment above.

@jeffwidman
Copy link
Member

I am not sure why GitHub is now marking the branches as conflicting and requiring an update before merging... regardless I went ahead and updated and will merge via rebase which should drop the merge commit from the history. Just waiting on the tests to finish.

@jeffwidman
Copy link
Member

@saffroy can you address the hound violation above? I personally don't see it as a blocker in this particular instance, but I don't have the permissions here to bypass it...

Please rebase to get rid of my merge commit and then I'll go ahead and merge this...

@jeffwidman jeffwidman dismissed their stale review September 26, 2018 05:26

Needs to fix hound violations

@jeffwidman
Copy link
Member

nudge @saffroy

Copy link
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

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

Thanks! Waiting for tests to pass, then will merge.

@jeffwidman jeffwidman merged commit 901cba7 into python-zk:master Oct 8, 2018
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