]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-p4: compare to singletons with "is" and "is not"
authorJoel Holdsworth <jholdsworth@nvidia.com>
Fri, 1 Apr 2022 14:25:00 +0000 (15:25 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Apr 2022 20:15:44 +0000 (13:15 -0700)
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>
git-p4.py

index a25adc8baee6e9a5e5db4cd649d8a781bd942f3e..2f2450f7d9b62ce7452bc539dceefd219fe8f55c 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -857,7 +857,7 @@ def p4Where(depotPath):
             if data[:space] == depotPath:
                 output = entry
                 break
-    if output == None:
+    if output is None:
         return ""
     if output["code"] == "error":
         return ""
@@ -879,7 +879,7 @@ def currentGitBranch():
 
 
 def isValidGitDir(path):
-    return git_dir(path) != None
+    return git_dir(path) is not None
 
 
 def parseRevision(ref):
@@ -4425,7 +4425,7 @@ def main():
     global verbose
     verbose = cmd.verbose
     if cmd.needsGit:
-        if cmd.gitdir == None:
+        if cmd.gitdir is None:
             cmd.gitdir = os.path.abspath(".git")
             if not isValidGitDir(cmd.gitdir):
                 # "rev-parse --git-dir" without arguments will try $PWD/.git