def apply_to_dir(path, style, recursive=False, in_place=False, verbose=False, pyonly=True):
    """
    Apply the style to all files in a directory.
    :param path: path to directory
    :type path: str
    :param style: path to style file
    :type style: str
    :param recursive: also descend into subdirectories
    :type recursive: bool
    :param in_place: apply the changes directly to the file
    :type in_place: bool
    :param verbose: print additional information
    :type verbose: bool
    :param pyonly: only apply to .py files
    :type pyonly: bool
    """
    if verbose:
        print("Applying style to directory '{}'...".format(path))
    for fn in os.listdir(path):
        fp = os.path.join(path, fn)
        if os.path.isdir(fp) and recursive:
            apply_to_dir(fp, style, recursive=recursive, in_place=in_place, verbose=verbose, pyonly=pyonly)
        elif os.path.isfile(fp):
            if (not fn.endswith(".py")) and pyonly:
                if verbose:
                    print("Skipping '{}' (non-py)...".format(fp))
                continue
            if verbose:
                print("Applying style to file '{}'...".format(fp))
            res = apply_to_file(fp, style, in_place=in_place)
            if not in_place:
                print("# ======= {} =======".format(fp))
                print(res)

    Apply the style to all files in a directory.
    :param path: path to directory
    :type path: str
    :param style: path to style file
    :type style: str
    :param recursive: also descend into subdirectories
    :type recursive: bool
    :param in_place: apply the changes directly to the file
    :type in_place: bool
    :param verbose: print additional information
    :type verbose: bool
    :param pyonly: only apply to .py files
    :type pyonly: bool
    
tools/apply_style.py