From 8bacc9fccb7b4c32ea0602beb6c2524dbe1548a6 Mon Sep 17 00:00:00 2001 From: luz paz Date: Mon, 19 Jul 2021 09:15:38 -0400 Subject: [PATCH] Fix python 'testing for equality' syntax 'Testing whether an object is 'None' using the == operator is inefficient and potentially incorrect.' Per https://lgtm.com/projects/g/KiCad/kicad-source-mirror/?mode=tree&ruleFocus=7900090 --- eeschema/plugins/python_scripts/kicad_netlist_reader.py | 2 +- pcbnew/python/plugins/kicad_qrcode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eeschema/plugins/python_scripts/kicad_netlist_reader.py b/eeschema/plugins/python_scripts/kicad_netlist_reader.py index 424404d6ce..5011b091fe 100644 --- a/eeschema/plugins/python_scripts/kicad_netlist_reader.py +++ b/eeschema/plugins/python_scripts/kicad_netlist_reader.py @@ -459,7 +459,7 @@ class netlist(): def addElement(self, name): """Add a new kicad generic element to the list""" - if self._curr_element == None: + if self._curr_element is None: self.tree = xmlElement(name) self._curr_element = self.tree else: diff --git a/pcbnew/python/plugins/kicad_qrcode.py b/pcbnew/python/plugins/kicad_qrcode.py index 1eecc61f4a..847321edf8 100644 --- a/pcbnew/python/plugins/kicad_qrcode.py +++ b/pcbnew/python/plugins/kicad_qrcode.py @@ -131,7 +131,7 @@ class QRCode: rows.reverse() for row in rows: for c in range(2): - if self.modules[row][col - c] == None: + if self.modules[row][col - c] is None: dark = False if byteIndex < len(data):