]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python: Use 'is' for identity when comparing against None
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 5 May 2022 09:42:47 +0000 (21:42 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 10 May 2022 06:12:10 +0000 (06:12 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue May 10 06:12:10 UTC 2022 on sn-devel-184

python/samba/netcmd/gpo.py
python/samba/samdb.py
python/samba/vgp_sudoers_ext.py
source4/scripting/bin/gen_error_common.py
source4/scripting/bin/gen_hresult.py

index 6b38e4e372ba16209ff096ff469b5e1e49fa274f..784c1676467a7a8bded54a4298eeb4a1313ba632 100644 (file)
@@ -1867,7 +1867,7 @@ samba-tool gpo manage sudoers list {31B2F340-016D-11D2-945F-00C04FB984F9}
                     else '%s%%' % u.text for u in principals])
             else:
                 uname = 'ALL'
-            nopassword = entry.find('password') == None
+            nopassword = entry.find('password') is None
             np_entry = ' NOPASSWD:' if nopassword else ''
             p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command)
             self.outf.write('%s\n' % p)
@@ -1946,7 +1946,7 @@ samba-tool gpo manage sudoers remove {31B2F340-016D-11D2-945F-00C04FB984F9} 'fak
                     else '%s%%' % u.text for u in principals])
             else:
                 uname = 'ALL'
-            nopassword = e.find('password') == None
+            nopassword = e.find('password') is None
             np_entry = ' NOPASSWD:' if nopassword else ''
             p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command)
             entries[p] = e
index fa9036b2b7b546dfecae39317b219b34b33915ca..fe5e1c407e1a6df3d0ed2e6e8ccc77a218699934 100644 (file)
@@ -464,7 +464,7 @@ member: %s
 
         # if the attribute is not specified, try to use the old one
         for attr_name, attr_value in attrs.items():
-            if attr_value == None and attr_name in old_attrs:
+            if attr_value is None and attr_name in old_attrs:
                 attrs[attr_name] = str(old_attrs[attr_name])
 
         # add '.' to initials if initals are not None and not "" and if the initials
index b9dab85971c7229bcb647769be573d7b81fa335c..8d2255beae8ee4114d8bd0d8d32dcfbce3143d67 100644 (file)
@@ -59,7 +59,7 @@ class vgp_sudoers_ext(gp_xml_ext):
                             else '%s%%' % u.text for u in principals])
                     else:
                         uname = 'ALL'
-                    nopassword = entry.find('password') == None
+                    nopassword = entry.find('password') is None
                     np_entry = ' NOPASSWD:' if nopassword else ''
                     p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command)
                     attribute = b64encode(p.encode()).decode()
@@ -108,7 +108,7 @@ class vgp_sudoers_ext(gp_xml_ext):
                         else '%s%%' % u.text for u in principals])
                 else:
                     uname = 'ALL'
-                nopassword = entry.find('password') == None
+                nopassword = entry.find('password') is None
                 np_entry = ' NOPASSWD:' if nopassword else ''
                 p = '%s ALL=(%s)%s %s' % (uname, user, np_entry, command)
                 if str(self) not in output.keys():
index 08aa2672c9e51d9bf33e6b698364bcc245f94774..aa71afaa85878751b7dad222e0e74fa1f7533fc9 100644 (file)
@@ -49,7 +49,7 @@ def parseErrorDescriptions( file_contents, isWinError, transformErrorFunction ):
     errors = []
     count = 0
     for line in file_contents:
-        if line == None or line == '\t' or line == "" or line == '\n':
+        if line is None or line == '\t' or line == "" or line == '\n':
             continue
         content = line.strip().split(None,1)
         # start new error definition ?
@@ -66,7 +66,7 @@ def parseErrorDescriptions( file_contents, isWinError, transformErrorFunction ):
             if len(errors) == 0:
                 continue
             err = errors[-1]
-            if err.err_define == None:
+            if err.err_define is None:
                 err.err_define = transformErrorFunction(content[0])
             else:
                 if len(content) > 0:
index 9bde42911f57e6f2e3dc7e174e84379da3345b73..6a75c37eba148543867b813be269a3510fdc821c 100755 (executable)
@@ -66,7 +66,7 @@ def parseErrorDescriptions( input_file, isWinError ):
                 print("Error parsing file as line %d"%count)
                 sys.exit()
             err = Errors[-1]
-            if err.err_define == None:
+            if err.err_define is None:
                 err.err_define = "HRES_" + content[0]
             else:
                 if len(content) > 0: