tilmanginzel / alfred-bluetooth-workflow

Yet another Alfred workflow to connect / disconnect Bluetooth devices
MIT License
189 stars 8 forks source link

#15 Filter devices with null values #16

Closed tilmanginzel closed 4 years ago

tilmanginzel commented 4 years ago

@trietsch Please review :)

This is probably not the most pythonic way for the condition, but it should do the job. Devices are now filtered if:

What do you think?

trietsch commented 4 years ago

Hey @tilmanginzel, the filtering you're describing above is not reflected in the PR, all three fields are just checked whether they're not None, not whether they've got any contents, i.e. a non-empty string. Did you commit all your changes?

tilmanginzel commented 4 years ago

@trietsch I might be missing something, but is this not a valid check if a string is empty (or None) in python?

➜  ~ python2.7
>>> s = ""
>>> if s:
...   print "a"
... else:
...   print "b"
...
b
>>> s = None
>>> if s:
...   print "a"
... else:
...   print "b"
...
b
>>>
trietsch commented 4 years ago

Ah, yeah, true indeed. I was mislead by the fact that you said that the third one had a different check. Feel free to merge (with or without the proposal of the check).

tilmanginzel commented 4 years ago

Ok great, will merge then and publish a new version! :)