turntable/utils.py
def Walk(root='.', recurse=True, pattern='*'):
    ''' 
    Generator for walking a directory tree.
    Starts at specified root folder, returning files that match our pattern. 
    Optionally will also recurse through sub-folders.

    Parameters
    ----------
    root : string (default is *'.'*)
        Path for the root folder to look in.
    recurse : bool (default is *True*)
        If *True*, will also look in the subfolders.
    pattern : string (default is :emphasis:`'*'`, which means all the files are concerned)
        The pattern to look for in the files' name.

    Returns
    -------
    generator
        **Walk** yields a generator from the matching files paths.

    '''

    for path, subdirs, files in os.walk(root):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                yield os.path.join(path, name)
        if not recurse:
            break
def Walk(root='.', recurse=True, pattern='*'):
    ''' 
    Generator for walking a directory tree.
    Starts at specified root folder, returning files that match our pattern. 
    Optionally will also recurse through sub-folders.

    Parameters
    ----------
    root : string (default is *'.'*)
        Path for the root folder to look in.
    recurse : bool (default is *True*)
        If *True*, will also look in the subfolders.
    pattern : string (default is :emphasis:`'*'`, which means all the files are concerned)
        The pattern to look for in the files' name.

    Returns
    -------
    generator
        **Walk** yields a generator from the matching files paths.

    '''

    for path, subdirs, files in os.walk(root):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                yield os.path.join(path, name)
        if not recurse:
            break
def Walk ( root = '.' , recurse = True , pattern = '*' ) : for path , subdirs , files in os . walk ( root ) : for name in files : if fnmatch . fnmatch ( name , pattern ) : yield os . path . join ( path , name ) if not recurse : break
Generator for walking a directory tree.
    Starts at specified root folder, returning files that match our pattern. 
    Optionally will also recurse through sub-folders.

    Parameters
    ----------
    root : string (default is *'.'*)
        Path for the root folder to look in.
    recurse : bool (default is *True*)
        If *True*, will also look in the subfolders.
    pattern : string (default is :emphasis:`'*'`, which means all the files are concerned)
        The pattern to look for in the files' name.

    Returns
    -------
    generator
        **Walk** yields a generator from the matching files paths.
Generator for walking a directory tree . Starts at specified root folder returning files that match our pattern . Optionally will also recurse through sub - folders .