From: Uwe Hermann Date: Fri, 10 Jan 2020 19:41:57 +0000 (+0100) Subject: sdcard_spi: Use ternary operator where possible. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=927e2ba624b780e8b846ce3cc2b013afac6fa751;p=libsigrokdecode.git sdcard_spi: Use ternary operator where possible. --- diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py index af896af..49cfdef 100644 --- a/decoders/sdcard_spi/pd.py +++ b/decoders/sdcard_spi/pd.py @@ -437,11 +437,9 @@ class Decoder(srd.Decoder): elif miso == 0x0d: self.put(m[3][1], m[1][2], self.out_ann, [Ann.BIT, ['Data rejected (write error)']]) self.put(m[0][1], m[0][2], self.out_ann, [Ann.BIT, ['Always 1']]) - ann_class = None - if self.is_cmd24: - ann_class = Ann.CMD24 - if ann_class is not None: - self.put(self.ss, self.es, self.out_ann, [ann_class, ['Data Response']]) + cls = Ann.CMD24 if self.is_cmd24 else None + if cls is not None: + self.put(self.ss, self.es, self.out_ann, [cls, ['Data Response']]) if self.is_cmd24: # We just send a block of data to be written to the card, # this takes some time. @@ -452,11 +450,9 @@ class Decoder(srd.Decoder): def wait_while_busy(self, miso): if miso != 0x00: - ann_class = None - if self.is_cmd24: - ann_class = Ann.CMD24 - if ann_class is not None: - self.put(self.ss_busy, self.es_busy, self.out_ann, [Ann.CMD24, ['Card is busy']]) + cls = Ann.CMD24 if self.is_cmd24 else None + if cls is not None: + self.put(self.ss_busy, self.es_busy, self.out_ann, [cls, ['Card is busy']]) self.state = 'IDLE' return else: