in bowler/tool.py [0:0]
def refactor_dir(self, dir_name: str, *a, **k) -> None:
"""Descends down a directory and refactor every Python file found.
Python files are those for which `self.filename_matcher(filename)`
returns true, to allow for custom extensions.
Files and subdirectories starting with '.' are skipped.
"""
for dirpath, dirnames, filenames in os.walk(dir_name):
self.log_debug("Descending into %s", dirpath)
dirnames.sort()
filenames.sort()
for name in filenames:
fullname = os.path.join(dirpath, name)
if not name.startswith(".") and self.filename_matcher(
Filename(fullname)
):
self.queue_work(Filename(fullname))
# Modify dirnames in-place to remove subdirs with leading dots
dirnames[:] = [dn for dn in dirnames if not dn.startswith(".")]