diff options
author | Joel Holdsworth <jholdsworth@nvidia.com> | 2022-04-01 15:25:00 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-04-01 13:15:44 -0700 |
commit | da0134f6534f407f8377ea97eb040ee6e49412e1 (patch) | |
tree | fdfbe6fe0435261a8b064f49f05de31752674d58 /git-p4.py | |
parent | 7a3e83d0bd1d8fe004cd2f3dd4bc03bc8ca6fe9e (diff) | |
download | git-da0134f6534f407f8377ea97eb040ee6e49412e1.tar.gz |
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>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-x | git-p4.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |