diff options
author | Tim Peters <tim.peters@gmail.com> | 2005-08-26 15:20:46 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2005-08-26 15:20:46 (GMT) |
commit | 9e34c047325651853a95f95e538582a4f6d5b7f6 (patch) | |
tree | 97ba789e8889e26e3fd5bd729d01d5e8e2c15d70 /Tools/scripts | |
parent | e8889c5741b636aa798757eb5500d304b1704344 (diff) | |
download | cpython-9e34c047325651853a95f95e538582a4f6d5b7f6.zip cpython-9e34c047325651853a95f95e538582a4f6d5b7f6.tar.gz cpython-9e34c047325651853a95f95e538582a4f6d5b7f6.tar.bz2 |
Whitespace normalization (via reindent.py).
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/findnocoding.py | 14 | ||||
-rw-r--r-- | Tools/scripts/pysource.py | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py index 707bf23..e8fc619 100755 --- a/Tools/scripts/findnocoding.py +++ b/Tools/scripts/findnocoding.py @@ -26,8 +26,8 @@ except: if filename.endswith(".py"): yield os.path.join(root, filename) pysource = pysource() - - + + print >>sys.stderr, ("The pysource module is not available; " "no sophisticated Python source file search will be done.") @@ -56,19 +56,19 @@ def needs_declaration(fullpath): line1 = infile.readline() line2 = infile.readline() - + if get_declaration(line1) or get_declaration(line2): # the file does have an encoding declaration, so trust it infile.close() return False - + # check the whole file for non-ASCII characters rest = infile.read() infile.close() - + if has_correct_encoding(line1+line2+rest, "ascii"): return False - + return True @@ -102,5 +102,3 @@ for fullpath in pysource.walk_python_files(args, is_python): result = needs_declaration(fullpath) if result: print fullpath - - diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py index 3b01bfc..d5eb515 100644 --- a/Tools/scripts/pysource.py +++ b/Tools/scripts/pysource.py @@ -57,12 +57,12 @@ def looks_like_python(fullpath): line = infile.readline() infile.close() - + if binary_re.search(line): # file appears to be binary print_debug("%s: appears to be binary" % fullpath) return False - + if fullpath.endswith(".py") or fullpath.endswith(".pyw"): return True elif "python" in line: @@ -95,12 +95,12 @@ def walk_python_files(paths, is_python=looks_like_python, exclude_dirs=None): paths: a list of files and/or directories to be checked. is_python: a function that takes a file name and checks whether it is a Python source file - exclude_dirs: a list of directory base names that should be excluded in + exclude_dirs: a list of directory base names that should be excluded in the search """ if exclude_dirs is None: exclude_dirs=[] - + for path in paths: print_debug("testing: %s" % path) if os.path.isfile(path): |