Skip to content

Commit 2d8360d

Browse files
committed
script: apply flake8 suggestions on gitlog2changelog.py
Apply on gitlog2changelog.py most code change suggestions from Flake8 Python style guide enforcement tool.
1 parent ff98426 commit 2d8360d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

script/gitlog2changelog.py.in

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# Minor changes for NUT by Charles Lepple
44
# Distributed under the terms of the GNU General Public License v2 or later
55

6-
import string, re, os
6+
import re
7+
import os
78
from textwrap import TextWrapper
89
import sys
910
import subprocess
@@ -40,7 +41,7 @@ try:
4041
fin, ferr = p.communicate()
4142
if p.wait() != 0:
4243
print("ERROR getting git changelog")
43-
system.exit(1)
44+
sys.exit(1)
4445
fin = fin.splitlines()
4546
fin_mode = 3
4647
except TypeError:
@@ -69,7 +70,10 @@ files = ""
6970
prevAuthorLine = ""
7071

7172
wrapper = TextWrapper(
72-
initial_indent=" ", subsequent_indent=" ", width=78, break_on_hyphens=False
73+
initial_indent=" ",
74+
subsequent_indent=" ",
75+
width=78,
76+
break_on_hyphens=False
7377
)
7478

7579
# The main part of the loop
@@ -115,7 +119,7 @@ for line in fin:
115119
elif "Signed-off-by" in line:
116120
continue
117121
# Extract the actual commit message for this commit
118-
elif authorFound & dateFound & messageFound == False:
122+
elif authorFound & dateFound & messageFound is False:
119123
# Find the commit message if we can
120124
if len(line) == fin_chop:
121125
if messageNL:
@@ -135,7 +139,7 @@ for line in fin:
135139
continue
136140
# Collect the files for this commit. FIXME: Still need to add +/- to files
137141
elif authorFound & dateFound & messageFound:
138-
fileList = re.split(" \| ", line, 2)
142+
fileList = re.split(r' \| ', line, 2)
139143
if len(fileList) > 1:
140144
if len(files) > 0:
141145
files = files + ", " + fileList[0].strip()

0 commit comments

Comments
 (0)