PEP8: fix E712: comparison to False should be 'if cond is False:' or 'if not cond:'
authorJoe Guo <joeg@catalyst.net.nz>
Mon, 30 Jul 2018 06:22:19 +0000 (18:22 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 24 Aug 2018 05:49:31 +0000 (07:49 +0200)
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/computer.py
python/samba/netcmd/fsmo.py
python/samba/netcmd/user.py
source4/torture/drs/python/fsmo.py

index ed70400f9d801d4144f738400852519f3ec5b5df..16e4bf8b5e6f064c9f2384026c6f54f32f303c4f 100644 (file)
@@ -384,7 +384,7 @@ sudo is used so a computer may run the command as root.
 
         computer_is_workstation = (
             computer_ac & dsdb.UF_WORKSTATION_TRUST_ACCOUNT)
-        if computer_is_workstation == False:
+        if not computer_is_workstation:
             raise CommandError('Failed to remove computer "%s": '
                                'Computer is not a workstation - removal denied'
                                % computername)
index 26bb3e75443d54aef8c74209ab70673e571a6a34..0c4ee7abf27789c365178d7e608265a38eac94c3 100644 (file)
@@ -298,7 +298,7 @@ You must provide an Admin user and password."""),
         else:
             seize = True
 
-        if force is not None or seize == True:
+        if force is not None or seize:
             self.message("Seizing %s FSMO role..." % role)
             m["fSMORoleOwner"] = ldb.MessageElement(
                 serviceName, ldb.FLAG_MOD_REPLACE,
@@ -381,7 +381,7 @@ You must provide an Admin user and password."""),
         else:
             seize = True
 
-        if force is not None or seize == True:
+        if force is not None or seize:
             self.message("Seizing %s FSMO role..." % role)
             m["fSMORoleOwner"] = ldb.MessageElement(
                 serviceName, ldb.FLAG_MOD_REPLACE,
index 06a7f545cb229a9a5d916bd3030e4f77027c5bda..7f4c09510500ba6266196fed4ba57aa1bf7da892 100644 (file)
@@ -1880,7 +1880,7 @@ samba-tool user syncpasswords --terminate \\
                 add_ldif += "dirsyncControl: %s\n" % self.dirsync_controls[0]
                 for a in self.password_attrs:
                     add_ldif += "passwordAttribute:: %s\n" % base64.b64encode(a).decode('utf8')
-                if self.decrypt_samba_gpg == True:
+                if self.decrypt_samba_gpg:
                     add_ldif += "decryptSambaGPG: TRUE\n"
                 else:
                     add_ldif += "decryptSambaGPG: FALSE\n"
index 3aca57e4101f96ae1e5c664b11336ec158e51d15..b20e850227a16fb6f3c9d2a0f10d9ef8a677dd07 100644 (file)
@@ -69,7 +69,7 @@ class DrsFsmoTestCase(drs_base.DrsBaseTestCase):
 
         self.assertCmdSuccess(result, out, err)
         self.assertEquals(err, "", "Shouldn't be any error messages")
-        if noop == False:
+        if not noop:
             self.assertTrue("FSMO transfer of '%s' role successful" % role in out)
         else:
             self.assertTrue("This DC already has the '%s' FSMO role" % role in out)