INNER CODE UNIT · Python
ignores
wasm3/wasm3 · extra/format.py:126
def ignores(self, dirpath, name, isdir):
"""True if the .gitignore in `dirpath`, or any of the ones above it up to the
repo root, names `dirpath/name`."""
path = os.path.join(dirpath, name)
d = os.path.normpath(dirpath)
while True:
anything, dirs_only = self.at(d)
rel = relative(path, d)
if rel in anything or (isdir and rel in dirs_only):
return True
parent = os.path.dirname(d)
if d == ROOT or parent == d:
return False
d = parent
def prune(self, dirpath, names, isdir):
"""Drop the ignored entries from `names`, in place. Handed the directories
os.walk offers, that is also how it is told not to descend into them."""