diff options
author | Jonathan Lange <jml@canonical.com> | 2012-07-08 14:07:07 +0100 |
---|---|---|
committer | Jonathan Lange <jml@canonical.com> | 2012-07-08 14:07:07 +0100 |
commit | 69d6a67f6533be58550e3515f0867dd3e9b385e5 (patch) | |
tree | c2cdcfa7b97c64b796b87702d30e0a434ae34bad /pyflakes/scripts | |
parent | b69c41e37267124c1449c0d17cc463ec6978d98b (diff) | |
download | pyflakes-69d6a67f6533be58550e3515f0867dd3e9b385e5.tar.gz |
Make iterSourceCode take many paths.
Diffstat (limited to 'pyflakes/scripts')
-rw-r--r-- | pyflakes/scripts/pyflakes.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/pyflakes/scripts/pyflakes.py b/pyflakes/scripts/pyflakes.py index b17271f..4725696 100644 --- a/pyflakes/scripts/pyflakes.py +++ b/pyflakes/scripts/pyflakes.py @@ -137,16 +137,22 @@ def checkPath(filename, reporter=None): -def iterSourceCode(directory): +def iterSourceCode(paths): """ - Iterate over all Python source files in C{directory}. + Iterate over all Python source files in C{paths}. - @param directory: A path to a directory. + @param paths: A list of paths. Directories will be recursed into and + any .py files found will be yielded. Any non-directories will be + yielded as-is. """ - for dirpath, dirnames, filenames in os.walk(directory): - for filename in filenames: - if filename.endswith('.py'): - yield os.path.join(dirpath, filename) + for path in paths: + if os.path.isdir(path): + for dirpath, dirnames, filenames in os.walk(path): + for filename in filenames: + if filename.endswith('.py'): + yield os.path.join(dirpath, filename) + else: + yield path |