in script/run-clang-format.py [0:0]
def list_files(files, recursive=False, extensions=None, exclude=None):
if extensions is None:
extensions = []
if exclude is None:
exclude = []
out = []
for f in files:
if recursive and os.path.isdir(f):
for dirpath, dnames, fnames in os.walk(f):
fpaths = [os.path.join(dirpath, fname) for fname in fnames]
for pattern in exclude:
dnames[:] = [
x for x in dnames
if
not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)
]
fpaths = [
x for x in fpaths if not fnmatch.fnmatch(x, pattern)
]
for fp in fpaths:
ext = os.path.splitext(f)[1][1:]
print(ext)
if ext in extensions:
out.append(fp)
else:
ext = os.path.splitext(f)[1][1:]
if ext in extensions:
out.append(f)
return out