def _gather_files(app, hidden, filepath_filter_regex=None):
    """ Gets all files in static folders and returns in dict."""
    dirs = [(six.text_type(app.static_folder), app.static_url_path)]
    if hasattr(app, 'blueprints'):
        blueprints = app.blueprints.values()
        bp_details = lambda x: (x.static_folder, _bp_static_url(x))
        dirs.extend([bp_details(x) for x in blueprints if x.static_folder])

    valid_files = defaultdict(list)
    for static_folder, static_url_loc in dirs:
        if not os.path.isdir(static_folder):
            logger.warning("WARNING - [%s does not exist]" % static_folder)
        else:
            logger.debug("Checking static folder: %s" % static_folder)
        for root, _, files in os.walk(static_folder):
            relative_folder = re.sub(r'^/',
                                     '',
                                     root.replace(static_folder, ''))

            files = [os.path.join(root, x)
                     for x in files if (
                         (hidden or x[0] != '.') and
                         # Skip this file if the filter regex is
                         # defined, and this file's path is a
                         # negative match.
                         (filepath_filter_regex == None or re.search(
                             filepath_filter_regex,
                             os.path.join(relative_folder, x))))]
            if files:
                valid_files[(static_folder, static_url_loc)].extend(files)
    return valid_files
def _gather_files ( app , hidden , filepath_filter_regex = None ) : dirs = [ ( six . text_type ( app . static_folder ) , app . static_url_path ) ] if hasattr ( app , 'blueprints' ) : blueprints = app . blueprints . values ( ) bp_details = lambda x : ( x . static_folder , _bp_static_url ( x ) ) dirs . extend ( [ bp_details ( x ) for x in blueprints if x . static_folder ] ) valid_files = defaultdict ( list ) for static_folder , static_url_loc in dirs : if not os . path . isdir ( static_folder ) : logger . warning ( "WARNING - [%s does not exist]" % static_folder ) else : logger . debug ( "Checking static folder: %s" % static_folder ) for root , _ , files in os . walk ( static_folder ) : relative_folder = re . sub ( r'^/' , '' , root . replace ( static_folder , '' ) ) files = [ os . path . join ( root , x ) for x in files if ( ( hidden or x [ 0 ] != '.' ) and ( filepath_filter_regex == None or re . search ( filepath_filter_regex , os . path . join ( relative_folder , x ) ) ) ) ] if files : valid_files [ ( static_folder , static_url_loc ) ] . extend ( files ) return valid_files
Gets all files in static folders and returns in dict.