commit:     4354ceea00b531054f552330371194bbbdb3efb1
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Tue Apr 12 12:32:27 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 13 03:26:36 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4354ceea

cleanup: replace '== None' with 'is None'

Essentially the following script:

    find -name '*.py' |xargs sed -i -e 's/== None/is None/g'

Reading through DEVELOPING it says to prefer 'foo is not None' over 'foo
!= None' and grepping for '== None' got a few hits.

Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ebuild                        | 2 +-
 bin/portageq                      | 2 +-
 lib/portage/_sets/files.py        | 2 +-
 lib/portage/cache/anydbm.py       | 2 +-
 lib/portage/cache/cache_errors.py | 2 +-
 lib/portage/mail.py               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/ebuild b/bin/ebuild
index bab8d52ad..546ab9d1c 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -435,7 +435,7 @@ for arg in pargs:
     except PermissionDenied as e:
         portage.writemsg("!!! Permission Denied: %s\n" % (e,), noiselevel=-1)
         a = 1
-    if a == None:
+    if a is None:
         print("Could not run the required binary?")
         a = 127
     if a:

diff --git a/bin/portageq b/bin/portageq
index 73657650c..a4ee319a0 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -1475,7 +1475,7 @@ def usage(argv):
     help_mode = "--help" in argv
     for name in commands:
         doc = docstrings.get(name)
-        if doc == None:
+        if doc is None:
             print("   " + name)
             print("      MISSING DOCUMENTATION!")
             print("")

diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py
index 30fc80bd4..4d7f6f1ab 100644
--- a/lib/portage/_sets/files.py
+++ b/lib/portage/_sets/files.py
@@ -59,7 +59,7 @@ class StaticFileSet(EditablePackageSet):
             if len(line) == 0 and key != None:
                 setattr(self, key, " ".join(value))
                 key = None
-            elif line[-1] == ":" and key == None:
+            elif line[-1] == ":" and key is None:
                 key = line[:-1].lower()
                 value = []
             elif key != None:

diff --git a/lib/portage/cache/anydbm.py b/lib/portage/cache/anydbm.py
index ce0077e3f..2ab82a9f8 100644
--- a/lib/portage/cache/anydbm.py
+++ b/lib/portage/cache/anydbm.py
@@ -55,7 +55,7 @@ class database(fs_template.FsBased):
 
             # try again if failed
             try:
-                if self.__db == None:
+                if self.__db is None:
                     # dbm.open() will not work with bytes in python-3.1:
                     #   TypeError: can't concat bytes to str
                     if gdbm is None:

diff --git a/lib/portage/cache/cache_errors.py 
b/lib/portage/cache/cache_errors.py
index 080029734..bc8114ec1 100644
--- a/lib/portage/cache/cache_errors.py
+++ b/lib/portage/cache/cache_errors.py
@@ -36,7 +36,7 @@ class GeneralCacheCorruption(CacheError):
 
 class InvalidRestriction(CacheError):
     def __init__(self, key, restriction, exception=None):
-        if exception == None:
+        if exception is None:
             exception = ""
         self.key, self.restriction, self.ex = key, restriction, ex
 

diff --git a/lib/portage/mail.py b/lib/portage/mail.py
index 7ffb0d269..82bad6676 100644
--- a/lib/portage/mail.py
+++ b/lib/portage/mail.py
@@ -42,7 +42,7 @@ def create_message(sender, recipient, subject, body, 
attachments=None):
     from email.mime.multipart import MIMEMultipart as MultipartMessage
     from email.utils import formatdate
 
-    if attachments == None:
+    if attachments is None:
         mymessage = TextMessage(body)
     else:
         mymessage = MultipartMessage()

Reply via email to