lama/paths.py
def walk(root: Path, depth=None):
    """
    Do a recursice walk for files up to a maximum depth
    """
    root = Path(root)

    if depth and depth == 1:
        for filename in root.iterdir():
            yield filename
    else:
        root_depth = len(root.parts)

        for dirpath, dirnames, filenames in os.walk(root):
            current_depth = len(Path(dirpath).parts)

            if current_depth - root_depth > depth:
                dirnames[:] = [] # Stop looking in subdirs
                continue

            for filename in filenames:
                yield Path(dirpath) / filename

    Do a recursice walk for files up to a maximum depth
    
Do a recursice walk for files up to a maximum depth
Do a recursice walk for files up to a maximum depth
def walk(root: Path, depth=None):
    root = Path(root)
    if depth and depth == 1:
        for filename in root.iterdir():
            yield filename
    else:
        root_depth = len(root.parts)
        for dirpath, dirnames, filenames in os.walk(root):
            current_depth = len(Path(dirpath).parts)
            if current_depth - root_depth > depth:
                dirnames[:] = [] 
                continue
            for filename in filenames:
                yield Path(dirpath) / filename
def walk ( root : Path , depth = None ) : root = Path ( root ) if depth and depth == 1 : for filename in root . iterdir ( ) : yield filename else : root_depth = len ( root . parts ) for dirpath , dirnames , filenames in os . walk ( root ) : current_depth = len ( Path ( dirpath ) . parts ) if current_depth - root_depth > depth : dirnames [ : ] = [ ] continue for filename in filenames : yield Path ( dirpath ) / filename
Do a recursice walk for files up to a maximum depth
Do a recursice walk for files up to a maximum depth
"""
    Do a recursice walk for files up to a maximum depth
    """ # Stop looking in subdirs
root
Path
depth