git-p4: remove padding from lists, tuples and function arguments

PEP8 discourages use of extraneous padding inside any parenthesis, brackets or braces in the "Pet Peeves" section: https://www.python.org/dev/peps/pep-0008/#pet-peeves This patch removes all cases of these. 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:24 UTC 84af8b854481d686674622424977ecc5cdf0d587
1 file changed +18 -18
git-p4.py
+18 -18
@@ -952,10 +952,10 @@ _gitConfig = {}
952
953 def gitConfig(key, typeSpecifier=None):
954 if key not in _gitConfig:
955 - cmd = [ "git", "config" ]
955 + cmd = ["git", "config"]
956 if typeSpecifier:
957 - cmd += [ typeSpecifier ]
958 - cmd += [ key ]
957 + cmd += [typeSpecifier]
958 + cmd += [key]
959 s = read_pipe(cmd, ignore_error=True)
960 _gitConfig[key] = s.strip()
961 return _gitConfig[key]
@@ -974,7 +974,7 @@ def gitConfigBool(key):
974
975 def gitConfigInt(key):
976 if key not in _gitConfig:
977 - cmd = [ "git", "config", "--int", key ]
977 + cmd = ["git", "config", "--int", key]
978 s = read_pipe(cmd, ignore_error=True)
979 v = s.strip()
980 try:
@@ -1030,7 +1030,7 @@ def p4BranchesInGit(branchesAreInRemotes=True):
1030 def branch_exists(branch):
1031 """Make sure that the given ref name really exists."""
1032
1033 - cmd = [ "git", "rev-parse", "--symbolic", "--verify", branch ]
1033 + cmd = ["git", "rev-parse", "--symbolic", "--verify", branch]
1034 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1035 out, _ = p.communicate()
1036 out = decode_text_stream(out)
@@ -1246,7 +1246,7 @@ def getClientSpec():
1246 client_name = entry["Client"]
1247
1248 # just the keys that start with "View"
1249 - view_keys = [ k for k in entry.keys() if k.startswith("View") ]
1249 + view_keys = [k for k in entry.keys() if k.startswith("View")]
1250
1251 # hold this new View
1252 view = View(client_name)
@@ -1512,8 +1512,8 @@ class GitLFS(LargeFileSystem):
1512
1513
1514 class Command:
1515 - delete_actions = ( "delete", "move/delete", "purge" )
1516 - add_actions = ( "add", "branch", "move/add" )
1515 + delete_actions = ("delete", "move/delete", "purge")
1516 + add_actions = ("add", "branch", "move/add")
1517
1518 def __init__(self):
1519 self.usage = "usage: %prog [options]"
@@ -2521,7 +2521,7 @@ class P4Submit(Command, P4UserMap):
2521 sys.exit(1)
2522 except Exception as e:
2523 print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\
2524 - "with the error '{0}'".format(e.message) )
2524 + "with the error '{0}'".format(e.message))
2525 sys.exit(1)
2526
2527 #
@@ -2726,7 +2726,7 @@ class View(object):
2726 if depot_path in self.client_spec_path_cache:
2727 return self.client_spec_path_cache[depot_path]
2728
2729 - die( "Error: %s is not found in client spec path" % depot_path )
2729 + die("Error: %s is not found in client spec path" % depot_path)
2730 return ""
2731
2732
@@ -3024,7 +3024,7 @@ class P4Sync(Command, P4UserMap):
3024 else:
3025 if p4_version_string().find('/NT') >= 0:
3026 text = text.replace(b'\r\n', b'\n')
3027 - contents = [ text ]
3027 + contents = [text]
3028
3029 if type_base == "apple":
3030 # Apple filetype files will be streamed as a concatenation of
@@ -3646,7 +3646,7 @@ class P4Sync(Command, P4UserMap):
3646 for branch in branches.keys():
3647 ## HACK --hwn
3648 branchPrefix = self.depotPaths[0] + branch + "/"
3649 - self.branchPrefixes = [ branchPrefix ]
3649 + self.branchPrefixes = [branchPrefix]
3650
3651 parent = ""
3652
@@ -3754,7 +3754,7 @@ class P4Sync(Command, P4UserMap):
3754 if info["action"] in self.delete_actions:
3755 continue
3756
3757 - for prop in ["depotFile", "rev", "action", "type" ]:
3757 + for prop in ["depotFile", "rev", "action", "type"]:
3758 details["%s%s" % (prop, fileCnt)] = info[prop]
3759
3760 fileCnt = fileCnt + 1
@@ -3908,7 +3908,7 @@ class P4Sync(Command, P4UserMap):
3908 if branch_arg_given:
3909 short = self.branch.split("/")[-1]
3910 if short in branches:
3911 - self.p4BranchesInGit = [ short ]
3911 + self.p4BranchesInGit = [short]
3912 else:
3913 self.p4BranchesInGit = branches.keys()
3914
@@ -4190,7 +4190,7 @@ class P4Clone(P4Sync):
4190 os.makedirs(self.cloneDestination)
4191 chdir(self.cloneDestination)
4192
4193 - init_cmd = [ "git", "init" ]
4193 + init_cmd = ["git", "init"]
4194 if self.cloneBare:
4195 init_cmd.append("--bare")
4196 retcode = subprocess.call(init_cmd)
@@ -4202,9 +4202,9 @@ class P4Clone(P4Sync):
4202
4203 # create a master branch and check out a work tree
4204 if gitBranchExists(self.branch):
4205 - system([ "git", "branch", currentGitBranch(), self.branch ])
4205 + system(["git", "branch", currentGitBranch(), self.branch])
4206 if not self.cloneBare:
4207 - system([ "git", "checkout", "-f" ])
4207 + system(["git", "checkout", "-f"])
4208 else:
4209 print('Not checking out any branch, use ' \
4210 '"git checkout -q -b master <branch>"')
@@ -4335,7 +4335,7 @@ class P4Unshelve(Command):
4335 class P4Branches(Command):
4336 def __init__(self):
4337 Command.__init__(self)
4338 - self.options = [ ]
4338 + self.options = []
4339 self.description = ("Shows the git branches that hold imports and their "
4340 + "corresponding perforce depot paths")
4341 self.verbose = False