diff mbox series

[16/20] git-p4: tidied visual indented lines of conditionals

Message ID 20220112134635.177877-17-jholdsworth@nvidia.com (mailing list archive)
State Superseded
Headers show
Series git-p4: Various code tidy-ups | expand

Commit Message

Joel Holdsworth Jan. 12, 2022, 1:46 p.m. UTC
PEP8 recommends that when wrapping the arguments of conditional
statements, an extra level of indentation should be added to distinguish
arguments from the body of the statement.

This guideline is described here:
https://www.python.org/dev/peps/pep-0008/#indentation

This patch either adds the indentation, or removes unnecessary wrapping.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
---
 git-p4.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

Comments

Eric Sunshine Jan. 12, 2022, 7:46 p.m. UTC | #1
On Wed, Jan 12, 2022 at 8:47 AM Joel Holdsworth <jholdsworth@nvidia.com> wrote:
> git-p4: tidied visual indented lines of conditionals

Perhaps:

    git-p4: normalize indentation of lines in conditionals

or something. (Probably not worth a re-roll.)


> PEP8 recommends that when wrapping the arguments of conditional
> statements, an extra level of indentation should be added to distinguish
> arguments from the body of the statement.
>
> This guideline is described here:
> https://www.python.org/dev/peps/pep-0008/#indentation
>
> This patch either adds the indentation, or removes unnecessary wrapping.
>
> Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
diff mbox series

Patch

diff --git a/git-p4.py b/git-p4.py
index 90e7922ebd..0159e35adc 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1158,8 +1158,7 @@  def createOrUpdateBranchesFromOrigin(localRefPrefix="refs/remotes/p4/", silent=T
         originHead = line
 
         original = extractSettingsGitLog(extractLogMessageFromGitCommit(originHead))
-        if ('depot-paths' not in original
-            or 'change' not in original):
+        if 'depot-paths' not in original or 'change' not in original:
             continue
 
         update = False
@@ -2170,8 +2169,8 @@  def applyCommit(self, id):
                     if regexp:
                         # this file is a possibility...look for RCS keywords.
                         for line in read_pipe_lines(
-                            ["git", "diff", "%s^..%s" % (id, id), file],
-                            raw=True):
+                                ["git", "diff", "%s^..%s" % (id, id), file],
+                                raw=True):
                             if regexp.search(line):
                                 if verbose:
                                     print("got keyword match on %s in %s in %s" % (regex.pattern, line, file))
@@ -3181,9 +3180,9 @@  def streamP4FilesCb(self, marshalled):
                 self.stream_file[k] = marshalled[k]
 
         if (verbose and
-            'streamContentSize' in self.stream_file and
-            'fileSize' in self.stream_file and
-            'depotFile' in self.stream_file):
+                'streamContentSize' in self.stream_file and
+                'fileSize' in self.stream_file and
+                'depotFile' in self.stream_file):
             size = int(self.stream_file["fileSize"])
             if size > 0:
                 progress = 100*self.stream_file['streamContentSize']/size
@@ -4000,8 +3999,7 @@  def run(self, args):
                 settings = extractSettingsGitLog(logMsg)
 
                 self.readOptions(settings)
-                if ('depot-paths' in settings
-                    and 'change' in settings):
+                if 'depot-paths' in settings and 'change' in settings:
                     change = int(settings['change']) + 1
                     p4Change = max(p4Change, change)