[gedit] Changed `== None` to `is None`. https://lgtm.com/projects/g/GNOME/gedit?mode=tree&severity=recommend



commit be89b89b6895e3ebda83899689983152c7e73e72
Author: overkill <1213e2f7 opayq com>
Date:   Mon Apr 6 00:45:34 2020 +0000

    Changed `== None` to `is None`.
    https://lgtm.com/projects/g/GNOME/gedit?mode=tree&severity=recommendation&ruleFocus=7900090

 gedit/Gedit.py                                  |  2 +-
 plugins/externaltools/tools/manager.py          | 10 +++++-----
 plugins/pythonconsole/pythonconsole/console.py  |  2 +-
 plugins/snippets/snippets/document.py           |  4 ++--
 plugins/snippets/snippets/library.py            |  6 +++---
 plugins/snippets/snippets/placeholder.py        |  6 +++---
 plugins/snippets/snippets/substitutionparser.py |  6 +++---
 7 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/gedit/Gedit.py b/gedit/Gedit.py
index af0de3078..c3a1f43e4 100644
--- a/gedit/Gedit.py
+++ b/gedit/Gedit.py
@@ -66,7 +66,7 @@ def get_trace_info(num_back_frames=0):
     try:
         for i in range(num_back_frames):
             back_frame = frame.f_back
-            if back_frame == None:
+            if back_frame is None:
                 break
             frame = back_frame
 
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index 07f58c3e9..072286be6 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -310,11 +310,11 @@ class Manager(GObject.Object):
         t1 = model.get_value(iter1, self.TOOL_COLUMN)
         t2 = model.get_value(iter2, self.TOOL_COLUMN)
 
-        if model.iter_parent(iter1) == None:
-            if t1 == None:
+        if model.iter_parent(iter1) is None:
+            if t1 is None:
                 return -1
 
-            if t2 == None:
+            if t2 is None:
                 return 1
 
             def lang_name(lang):
@@ -769,8 +769,8 @@ class Manager(GObject.Object):
     def get_cell_data_cb(self, column, cell, model, piter, user_data=None):
         tool = model.get_value(piter, self.TOOL_COLUMN)
 
-        if tool == None or not isinstance(tool, Tool):
-            if tool == None:
+        if tool is None or not isinstance(tool, Tool):
+            if tool is None:
                 label = _('All Languages')
             elif not isinstance(tool, GtkSource.Language):
                 label = _('Plain Text')
diff --git a/plugins/pythonconsole/pythonconsole/console.py b/plugins/pythonconsole/pythonconsole/console.py
index 4e6c56b70..b81e8a7a5 100644
--- a/plugins/pythonconsole/pythonconsole/console.py
+++ b/plugins/pythonconsole/pythonconsole/console.py
@@ -127,7 +127,7 @@ class PythonConsole(Gtk.ScrolledWindow):
                     except:
                         pass
 
-                if font_desc == None:
+                if font_desc is None:
                     try:
                         font_desc = Pango.FontDescription(self.DEFAULT_FONT)
                     except:
diff --git a/plugins/snippets/snippets/document.py b/plugins/snippets/snippets/document.py
index 19dcf696b..23df28091 100644
--- a/plugins/snippets/snippets/document.py
+++ b/plugins/snippets/snippets/document.py
@@ -116,7 +116,7 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
     def update_language(self):
         lang = self.view.get_buffer().get_language()
 
-        if lang == None and self.language_id == None:
+        if lang is None and self.language_id is None:
             return
         elif lang and lang.get_id() == self.language_id:
             return
@@ -232,7 +232,7 @@ class Document(GObject.Object, Gedit.ViewActivatable, Signals):
             # Find the current placeholder
             if piter.compare(begin) >= 0 and \
                     piter.compare(end) <= 0 and \
-                    current == None:
+                    current is None:
                 currentIndex = index
                 current = placeholder
 
diff --git a/plugins/snippets/snippets/library.py b/plugins/snippets/snippets/library.py
index 455ac91dd..7ce163b03 100644
--- a/plugins/snippets/snippets/library.py
+++ b/plugins/snippets/snippets/library.py
@@ -68,7 +68,7 @@ class SnippetData:
         self.init_snippet_data(node)
 
     def init_snippet_data(self, node):
-        if node == None:
+        if node is None:
             return
 
         self.override = node.attrib.get('override')
@@ -551,7 +551,7 @@ class SnippetsUserFile(SnippetsSystemFile):
             return None
 
     def new_snippet(self, properties=None):
-        if (not self.ok) or self.root == None:
+        if (not self.ok) or self.root is None:
             return None
 
         element = et.SubElement(self.root, 'snippet')
@@ -609,7 +609,7 @@ class SnippetsUserFile(SnippetsSystemFile):
             Library().remove_library(self)
 
     def save(self):
-        if not self.ok or self.root == None or not self.tainted:
+        if not self.ok or self.root is None or not self.tainted:
             return
 
         path = os.path.dirname(self.path)
diff --git a/plugins/snippets/snippets/placeholder.py b/plugins/snippets/snippets/placeholder.py
index aaa5e3d22..e70a31e37 100644
--- a/plugins/snippets/snippets/placeholder.py
+++ b/plugins/snippets/snippets/placeholder.py
@@ -380,7 +380,7 @@ class PlaceholderExpand(Placeholder):
                 if tabstop == 0:
                     continue
 
-                if self.mirror_text[tabstop] == None:
+                if self.mirror_text[tabstop] is None:
                     return False
 
         return self.run_update()
@@ -428,7 +428,7 @@ class PlaceholderShell(PlaceholderExpand):
 
         self.set_text(str.join('', self.shell_output).rstrip('\n'))
 
-        if self.default == None:
+        if self.default is None:
             self.default = self.get_text()
             self.leave()
 
@@ -615,7 +615,7 @@ class PlaceholderEval(PlaceholderExpand):
 
                 return False
 
-            if result == None:
+            if result is None:
                 # sys.stderr.write("%s:\n>> %s\n" % (_('The following python code, run in a snippet, does 
not return a value'), "\n>> ".join(self.command.split("\n"))))
                 result = ''
 
diff --git a/plugins/snippets/snippets/substitutionparser.py b/plugins/snippets/snippets/substitutionparser.py
index da62f7b00..8469dd333 100644
--- a/plugins/snippets/snippets/substitutionparser.py
+++ b/plugins/snippets/snippets/substitutionparser.py
@@ -178,17 +178,17 @@ class SubstitutionParser:
         tokens = self._remains(tokens, 2)
         condition, tokens = self._condition_value(tokens)
 
-        if condition == None or self._peek(tokens) != ',':
+        if condition is None or self._peek(tokens) != ',':
             raise ParseError
 
         truepart, tokens = self._parse(self._remains(tokens), ',')
 
-        if truepart == None:
+        if truepart is None:
             raise ParseError
 
         falsepart, tokens = self._parse(tokens, ')')
 
-        if falsepart == None:
+        if falsepart is None:
             raise ParseError
 
         if condition:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]