From: Uwe Hermann Date: Wed, 6 Nov 2019 22:41:48 +0000 (+0100) Subject: seven_segment: Simplify two code snippets. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=9e953ff151c5d714dd57ec81eb402ec1d77ab8e7;p=libsigrokdecode.git seven_segment: Simplify two code snippets. --- diff --git a/decoders/seven_segment/pd.py b/decoders/seven_segment/pd.py index 26d1d83..87714bb 100644 --- a/decoders/seven_segment/pd.py +++ b/decoders/seven_segment/pd.py @@ -88,10 +88,7 @@ class Decoder(srd.Decoder): self.put(ss_block, es_block, self.out_ann, data) def pins_to_hex(self, pins): - if pins in digits: - return digits[pins] - else: - return None + return digits.get(pins, None) def decode(self): oldpins = self.wait() @@ -127,9 +124,8 @@ class Decoder(srd.Decoder): dp = oldpins[7] # Check if decimal point is present and active. - if self.have_dp: - if dp == 1: - digit = digit + '.' + if self.have_dp and dp == 1: + digit += '.' self.putb(lastpos, self.samplenum, [0, [digit]])