Skip to content

Commit

Permalink
job: improve "long line" calculation in JobInfo.showInOrder
Browse files Browse the repository at this point in the history
The new pylint took exception with using `if` instead of the `max()` builtin, but
then I discovered that max(list-comprehension) was twice as fast anyway.
  • Loading branch information
wwade committed Feb 26, 2024
1 parent ed066da commit 2c43529
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions jobrunner/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,7 @@ def getValue(self, what):

def showInOrder(self, order: Iterable[str],
level: Optional[Sized] = None) -> str:
longLine = 0
for k in order:
if len(k) > longLine:
longLine = len(k)
longLine = max(len(k) for k in order)
ret = utils.SPACER + "\n"
for k in order:
fmt = "%%-%ds %%s\n" % longLine
Expand Down

0 comments on commit 2c43529

Please sign in to comment.