Skip to content

Commit 7cabb21

Browse files
committed
Fix PEP8 for tidy
1 parent 1db2039 commit 7cabb21

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/etc/tidy.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,45 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
import sys, fileinput, subprocess, re, os
11+
import sys
12+
import fileinput
13+
import subprocess
14+
import re
15+
import os
1216
from licenseck import *
1317
import snapshot
1418

15-
err=0
16-
cols=100
17-
cr_flag="ignore-tidy-cr"
18-
tab_flag="ignore-tidy-tab"
19-
linelength_flag="ignore-tidy-linelength"
19+
err = 0
20+
cols = 100
21+
cr_flag = "ignore-tidy-cr"
22+
tab_flag = "ignore-tidy-tab"
23+
linelength_flag = "ignore-tidy-linelength"
2024

2125
# Be careful to support Python 2.4, 2.6, and 3.x here!
22-
config_proc=subprocess.Popen([ "git", "config", "core.autocrlf" ],
23-
stdout=subprocess.PIPE)
24-
result=config_proc.communicate()[0]
26+
config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
27+
stdout=subprocess.PIPE)
28+
result = config_proc.communicate()[0]
29+
30+
true = "true".encode('utf8')
31+
autocrlf = result.strip() == true if result is not None else False
2532

26-
true="true".encode('utf8')
27-
autocrlf=result.strip() == true if result is not None else False
2833

2934
def report_error_name_no(name, no, s):
3035
global err
3136
print("%s:%d: %s" % (name, no, s))
32-
err=1
37+
err = 1
38+
3339

3440
def report_err(s):
3541
report_error_name_no(fileinput.filename(), fileinput.filelineno(), s)
3642

43+
3744
def report_warn(s):
3845
print("%s:%d: %s" % (fileinput.filename(),
3946
fileinput.filelineno(),
4047
s))
4148

49+
4250
def do_license_check(name, contents):
4351
if not check_license(name, contents):
4452
report_error_name_no(name, 1, "incorrect license")
@@ -81,13 +89,13 @@ def do_license_check(name, contents):
8189
date, rev = snapshot.curr_snapshot_rev()
8290
if not hsh.startswith(rev):
8391
report_err("snapshot out of date (" + date
84-
+ "): " + line)
92+
+ "): " + line)
8593
else:
8694
if "SNAP" in line:
8795
report_warn("unmatched SNAP line: " + line)
8896

8997
if check_tab and ('\t' in line and
90-
"Makefile" not in fileinput.filename()):
98+
"Makefile" not in fileinput.filename()):
9199
report_err("tab character")
92100
if check_cr and not autocrlf and '\r' in line:
93101
report_err("CR character")

0 commit comments

Comments
 (0)