Improve dict iteration and list reversal
- use dict.items() to get at keys and values in one go - list.reverse() reverses the list in place, use reversed() instead Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
bc99e99b0c
commit
81c50d20d0
1 changed files with 3 additions and 4 deletions
|
@ -100,10 +100,9 @@ def main(args):
|
|||
print("No more spec file, bailing")
|
||||
break
|
||||
|
||||
for nvr in data:
|
||||
commits = data[nvr].reverse()
|
||||
for idx, commit in enumerate(data[nvr]):
|
||||
last_commit = idx + 1 == len(data[nvr])
|
||||
for nvr, commits in data.items():
|
||||
for idx, commit in enumerate(reversed(commits)):
|
||||
last_commit = idx + 1 == len(commits)
|
||||
commit_dt = datetime.datetime.utcfromtimestamp(commit.commit_time)
|
||||
wrapper = textwrap.TextWrapper(width=75, subsequent_indent=" ")
|
||||
message = wrapper.fill(commit.message.split("\n")[0].strip("- "))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue