summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorNikolay Kim <fafhrd91@gmail.com>2013-01-29 16:54:34 -0800
committerNikolay Kim <fafhrd91@gmail.com>2013-01-29 16:54:34 -0800
commite7c2ec811ab52008a37f5eaf8e57fb14ea2b9ebb (patch)
tree5332e130a2c0fb90128fa234d836d117a9ef892f /check.py
parent69977163b4f7ed9922990b83fd82b2522f1a0b5d (diff)
downloadtrollius-e7c2ec811ab52008a37f5eaf8e57fb14ea2b9ebb.tar.gz
Use pep8 naming style for test names
Diffstat (limited to 'check.py')
-rw-r--r--check.py59
1 files changed, 30 insertions, 29 deletions
diff --git a/check.py b/check.py
index f0aa9a6..64bc2cd 100644
--- a/check.py
+++ b/check.py
@@ -3,38 +3,39 @@
import sys, os
def main():
- args = sys.argv[1:] or os.curdir
- for arg in args:
- if os.path.isdir(arg):
- for dn, dirs, files in os.walk(arg):
- for fn in sorted(files):
- if fn.endswith('.py'):
- process(os.path.join(dn, fn))
- dirs[:] = [d for d in dirs if d[0] != '.']
- dirs.sort()
- else:
- process(arg)
+ args = sys.argv[1:] or os.curdir
+ for arg in args:
+ if os.path.isdir(arg):
+ for dn, dirs, files in os.walk(arg):
+ for fn in sorted(files):
+ if fn.endswith('.py'):
+ process(os.path.join(dn, fn))
+ dirs[:] = [d for d in dirs if d[0] != '.']
+ dirs.sort()
+ else:
+ process(arg)
def isascii(x):
- try:
- x.encode('ascii')
- return True
- except UnicodeError:
- return False
+ try:
+ x.encode('ascii')
+ return True
+ except UnicodeError:
+ return False
def process(fn):
- try:
- f = open(fn)
- except IOError as err:
- print(err)
- return
- try:
- for i, line in enumerate(f):
- line = line.rstrip('\n')
- sline = line.rstrip()
- if len(line) > 80 or line != sline or not isascii(line):
- print('%s:%d:%s%s' % (fn, i+1, sline, '_' * (len(line) - len(sline))))
- finally:
- f.close()
+ try:
+ f = open(fn)
+ except IOError as err:
+ print(err)
+ return
+ try:
+ for i, line in enumerate(f):
+ line = line.rstrip('\n')
+ sline = line.rstrip()
+ if len(line) > 80 or line != sline or not isascii(line):
+ print('%s:%d:%s%s' % (
+ fn, i+1, sline, '_' * (len(line) - len(sline))))
+ finally:
+ f.close()
main()