(names, pat)
return result
Return the subset of the list NAMES that match PAT.
Return the subset of the list NAMES that match PAT.
Return the subset of the list NAMES that match PAT .
def filter(names, pat):
    """Return the subset of the list NAMES that match PAT."""
    result = []
    pat = os.path.normcase(pat)
    match = _compile_pattern(pat, isinstance(pat, bytes))
    if os.path is posixpath:
        # normcase on posix is NOP. Optimize it away from the loop.
        for name in names:
            if match(name):
                result.append(name)
    else:
        for name in names:
            if match(os.path.normcase(name)):
                result.append(name)
    return result
def filter ( names , pat ) : result = [ ] pat = os . path . normcase ( pat ) match = _compile_pattern ( pat , isinstance ( pat , bytes ) ) if os . path is posixpath : # normcase on posix is NOP. Optimize it away from the loop. for name in names : if match ( name ) : result . append ( name ) else : for name in names : if match ( os . path . normcase ( name ) ) : result . append ( name ) return result