summaryrefslogtreecommitdiffstats
path: root/tools/scripts/addheader.py
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-10-30 18:57:40 +0100
committerRémi Verschelde <rverschelde@gmail.com>2016-11-01 00:35:16 +0100
commitd4c17700aa2f36f69978beda04e42ff2749de270 (patch)
tree466f774d5fff723d6496e7259529c366fe01855a /tools/scripts/addheader.py
parent97c8508f5e4f57b1048830d44e76e1f4517fd449 (diff)
downloadredot-engine-d4c17700aa2f36f69978beda04e42ff2749de270.tar.gz
style: Fix PEP8 whitespace issues in Python files
Done with `autopep8 --select=E2,W2`, fixes: - E201 - Remove extraneous whitespace. - E202 - Remove extraneous whitespace. - E203 - Remove extraneous whitespace. - E211 - Remove extraneous whitespace. - E221 - Fix extraneous whitespace around keywords. - E222 - Fix extraneous whitespace around keywords. - E223 - Fix extraneous whitespace around keywords. - E224 - Remove extraneous whitespace around operator. - E225 - Fix missing whitespace around operator. - E226 - Fix missing whitespace around operator. - E227 - Fix missing whitespace around operator. - E228 - Fix missing whitespace around operator. - E231 - Add missing whitespace. - E231 - Fix various deprecated code (via lib2to3). - E241 - Fix extraneous whitespace around keywords. - E242 - Remove extraneous whitespace around operator. - E251 - Remove whitespace around parameter '=' sign. - E261 - Fix spacing after comment hash. - E262 - Fix spacing after comment hash. - E265 - Format block comments. - E271 - Fix extraneous whitespace around keywords. - E272 - Fix extraneous whitespace around keywords. - E273 - Fix extraneous whitespace around keywords. - E274 - Fix extraneous whitespace around keywords. - W291 - Remove trailing whitespace. - W293 - Remove trailing whitespace.
Diffstat (limited to 'tools/scripts/addheader.py')
-rw-r--r--tools/scripts/addheader.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/tools/scripts/addheader.py b/tools/scripts/addheader.py
index fac35372de..573d5182f5 100644
--- a/tools/scripts/addheader.py
+++ b/tools/scripts/addheader.py
@@ -1,4 +1,4 @@
-header="""\
+header = """\
/*************************************************************************/
/* $filename */
/*************************************************************************/
@@ -29,44 +29,44 @@ header="""\
/*************************************************************************/
"""
-f = open("files","rb")
+f = open("files", "rb")
fname = f.readline()
-while (fname!=""):
+while (fname != ""):
- fr = open(fname.strip(),"rb")
+ fr = open(fname.strip(), "rb")
l = fr.readline()
- bc=False
+ bc = False
fsingle = fname.strip()
- if (fsingle.find("/")!=-1):
- fsingle=fsingle[fsingle.rfind("/")+1:]
- rep_fl="$filename"
- rep_fi=fsingle
- len_fl=len(rep_fl)
- len_fi=len(rep_fi)
- if (len_fi<len_fl):
- for x in range(len_fl-len_fi):
- rep_fi+=" "
- elif (len_fl<len_fi):
- for x in range(len_fi-len_fl):
- rep_fl+=" "
- if (header.find(rep_fl)!=-1):
- text=header.replace(rep_fl,rep_fi)
+ if (fsingle.find("/") != -1):
+ fsingle = fsingle[fsingle.rfind("/") + 1:]
+ rep_fl = "$filename"
+ rep_fi = fsingle
+ len_fl = len(rep_fl)
+ len_fi = len(rep_fi)
+ if (len_fi < len_fl):
+ for x in range(len_fl - len_fi):
+ rep_fi += " "
+ elif (len_fl < len_fi):
+ for x in range(len_fi - len_fl):
+ rep_fl += " "
+ if (header.find(rep_fl) != -1):
+ text = header.replace(rep_fl, rep_fi)
else:
- text=header.replace("$filename",fsingle)
+ text = header.replace("$filename", fsingle)
- while (l!=""):
- if ((l.find("//")!=0 and l.find("/*")!=0 and l.strip()!="") or bc):
- text+=l
- bc=True
- l=fr.readline()
+ while (l != ""):
+ if ((l.find("//") != 0 and l.find("/*") != 0 and l.strip() != "") or bc):
+ text += l
+ bc = True
+ l = fr.readline()
fr.close()
- fr=open(fname.strip(),"wb")
+ fr = open(fname.strip(), "wb")
fr.write(text)
fr.close()
- #print(text)
- fname=f.readline()
+ # print(text)
+ fname = f.readline()