git-p4: compare to singletons with "is" and "is not"
PEP8 recommends that comparisons with singletons such as None should be done with "is" and "is not", and never equality operators. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#programming-recommendations Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Joel Holdsworth committed
Apr 1, 2022 at 15:25 UTC
da0134f6534f407f8377ea97eb040ee6e49412e1
1 file changed
+3
-3
git-p4.py
+3
-3
@@ -857,7 +857,7 @@ def p4Where(depotPath):
857
if data[:space] == depotPath:
858
output = entry
859
break
860
- if output == None:
860
+ if output is None:
861
return ""
862
if output["code"] == "error":
863
return ""
@@ -879,7 +879,7 @@ def currentGitBranch():
879
880
881
def isValidGitDir(path):
882
- return git_dir(path) != None
882
+ return git_dir(path) is not None
883
884
885
def parseRevision(ref):
@@ -4425,7 +4425,7 @@ def main():
4425
global verbose
4426
verbose = cmd.verbose
4427
if cmd.needsGit:
4428
- if cmd.gitdir == None:
4428
+ if cmd.gitdir is None:
4429
cmd.gitdir = os.path.abspath(".git")
4430
if not isValidGitDir(cmd.gitdir):
4431
# "rev-parse --git-dir" without arguments will try $PWD/.git