def _walk_files(self, path):
"""Walk paths and yield Python paths
Directories and files are yielded in alphabetical order. Directories
starting with a "." are skipped. As are those that match any provided
ignore patterns.
"""
if os.path.isfile(path):
yield path
elif not os.path.isdir(path):
LOG.error("The path '%s' can't be found.", path)
raise StopIteration
for root, dirs, filenames in os.walk(path):
# Remove dot-directories from the dirs list.
dirs[:] = sorted(d for d in dirs if not d.startswith('.') and
not self._is_ignored(d))
for filename in sorted(filenames):
if self._is_python(filename):
yield os.path.join(root, filename)
评论列表
文章目录