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 library.lookup with an empty uri list #1620

Merged
merged 1 commit into from Jun 15, 2017

Conversation

3 participants
@kingosticks
Member

kingosticks commented May 17, 2017

Fixes #1619.

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jun 14, 2017

Any comments or shall I just merge?

for backend, backend_uris in self._get_backends_to_uris(uris).items():
for u in backend_uris:
futures[(backend, u)] = backend.library.lookup(u)
futures = {

This comment has been minimized.

@adamcik

adamcik Jun 14, 2017

Member

I find this a lot harder to read and parse with the multiple for loops in this expansion. To the point of it being hard to follow what the real change is.

This comment has been minimized.

@kingosticks

kingosticks Jun 14, 2017

Member

I actually totally agree, I pretty much copied it from the other similar place it was used.

@kingosticks kingosticks force-pushed the kingosticks:fix/library_lookup_empty_uris branch from 9464862 to 0933af7 Jun 14, 2017

@kingosticks kingosticks force-pushed the kingosticks:fix/library_lookup_empty_uris branch from 0933af7 to d6eff50 Jun 14, 2017

@kingosticks

This comment has been minimized.

Member

kingosticks commented Jun 14, 2017

I think this is much clearer.

@@ -228,8 +228,9 @@ def lookup(self, uri=None, uris=None):
# TODO: lookup(uris) to backend APIs
for backend, backend_uris in self._get_backends_to_uris(uris).items():
for u in backend_uris:
futures[(backend, u)] = backend.library.lookup(u)
if backend_uris:

This comment has been minimized.

@adamcik

adamcik Jun 15, 2017

Member

Could also be for u in backend_uris or [] I think, but either way is fine with me.

This comment has been minimized.

@kingosticks

kingosticks Jun 15, 2017

Member

Hehe, Yeh, but I've gone from super obfuscated to super obvious here - no middle ground!

@kingosticks kingosticks merged commit 9554a3b into mopidy:develop Jun 15, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kingosticks kingosticks deleted the kingosticks:fix/library_lookup_empty_uris branch Jun 15, 2017

@jodal jodal added this to the v2.2 milestone Mar 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment