diff options
author | Ryan Jarvis <ryan@shopboxretail.com> | 2019-01-19 00:05:07 -0800 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2019-01-30 00:08:39 +0100 |
commit | 16d2031b149ff67be83b5600bdf5ad561add312d (patch) | |
tree | 242478dfaba1fa4e1542cfa492e328e4f8ffa6d0 /decoders/lin | |
parent | f78b814d54b19233d5e3f7cfef3d30a7a5ac8d40 (diff) | |
download | libsigrokdecode-16d2031b149ff67be83b5600bdf5ad561add312d.tar.gz libsigrokdecode-16d2031b149ff67be83b5600bdf5ad561add312d.zip |
Rename values that shadow built-in keywords
Diffstat (limited to 'decoders/lin')
-rw-r--r-- | decoders/lin/pd.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/decoders/lin/pd.py b/decoders/lin/pd.py index e0340fc..e1b6d1b 100644 --- a/decoders/lin/pd.py +++ b/decoders/lin/pd.py @@ -150,7 +150,7 @@ class Decoder(srd.Decoder): checksum = self.lin_rsp.pop() if len(self.lin_rsp) else None if pid: - id = pid[2] & 0x3F + id_ = pid[2] & 0x3F parity = pid[2] >> 6 expected_parity = self.calc_parity(pid[2]) @@ -161,8 +161,8 @@ class Decoder(srd.Decoder): ann_class = 0 if parity_valid else 3 self.put(pid[0], pid[1], self.out_ann, [ann_class, [ - 'ID: %02X Parity: %d (%s)' % (id, parity, 'ok' if parity_valid else 'bad'), - 'ID: 0x%02X' % id, 'I: %d' % id + 'ID: %02X Parity: %d (%s)' % (id_, parity, 'ok' if parity_valid else 'bad'), + 'ID: 0x%02X' % id_, 'I: %d' % id_ ]]) if len(self.lin_rsp): @@ -188,9 +188,9 @@ class Decoder(srd.Decoder): def checksum_is_valid(self, pid, data, checksum): if self.lin_version == 2: - id = pid & 0x3F + id_ = pid & 0x3F - if id != 60 and id != 61: + if id_ != 60 and id_ != 61: checksum += pid for d in data: @@ -203,10 +203,10 @@ class Decoder(srd.Decoder): @staticmethod def calc_parity(pid): - id = [((pid & 0x3F) >> i) & 1 for i in range(8)] + id_ = [((pid & 0x3F) >> i) & 1 for i in range(8)] - p0 = id[0] ^ id[1] ^ id[2] ^ id[4] - p1 = not (id[1] ^ id[3] ^ id[4] ^ id[5]) + p0 = id_[0] ^ id_[1] ^ id_[2] ^ id_[4] + p1 = not (id_[1] ^ id_[3] ^ id_[4] ^ id_[5]) return (p0 << 0) | (p1 << 1) |