summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-12-22 18:37:29 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2017-12-22 18:58:43 +0100
commit279331bd318c853e3aaac746167eb81179771750 (patch)
tree06dfdbd8df1eb84c5c8c00c2cf5d052f299fceb3
parent57ba804a912c0753aefcaf8eee2f19ad7f5e86e5 (diff)
downloadlibsigrokdecode-279331bd318c853e3aaac746167eb81179771750.tar.gz
libsigrokdecode-279331bd318c853e3aaac746167eb81179771750.zip
usb_power_delivery: fixup a Python style nit (dict lookup fallback)
Use the dictionary's .get() method in combination with a default result parameter, instead of an explicit "k in dictvar" test and a conditional assignment.
-rw-r--r--decoders/usb_power_delivery/pd.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/decoders/usb_power_delivery/pd.py b/decoders/usb_power_delivery/pd.py
index ef9a97c..de6f394 100644
--- a/decoders/usb_power_delivery/pd.py
+++ b/decoders/usb_power_delivery/pd.py
@@ -412,7 +412,7 @@ class Decoder(srd.Decoder):
for i in range(len(self.bits) - 19):
k = (self.get_sym(i, rec=False), self.get_sym(i+5, rec=False),
self.get_sym(i+10, rec=False), self.get_sym(i+15, rec=False))
- sym = START_OF_PACKETS[k] if k in START_OF_PACKETS else None
+ sym = START_OF_PACKETS.get(k, None)
if not sym:
sym = self.find_corrupted_sop(k)
# We have an interesting symbol sequence