From: Joe Guo Date: Mon, 30 Jul 2018 06:22:19 +0000 (+1200) Subject: PEP8: fix E712: comparison to False should be 'if cond is False:' or 'if not cond:' X-Git-Tag: tdb-1.3.17~2048 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1676a4dcae505142036dff49eb4d65ff6e9854b2;p=thirdparty%2Fsamba.git PEP8: fix E712: comparison to False should be 'if cond is False:' or 'if not cond:' Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/computer.py b/python/samba/netcmd/computer.py index ed70400f9d8..16e4bf8b5e6 100644 --- a/python/samba/netcmd/computer.py +++ b/python/samba/netcmd/computer.py @@ -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) diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py index 26bb3e75443..0c4ee7abf27 100644 --- a/python/samba/netcmd/fsmo.py +++ b/python/samba/netcmd/fsmo.py @@ -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, diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 06a7f545cb2..7f4c0951050 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -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" diff --git a/source4/torture/drs/python/fsmo.py b/source4/torture/drs/python/fsmo.py index 3aca57e4101..b20e850227a 100644 --- a/source4/torture/drs/python/fsmo.py +++ b/source4/torture/drs/python/fsmo.py @@ -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)