parameters: (names, pat)
return_statement: return result
docstring: Return the subset of the list NAMES that match PAT.
docstring_summary: Return the subset of the list NAMES that match PAT.
docstring_tokens: Return the subset of the list NAMES that match PAT .
function: def filter(names, pat):
      """Return the subset of the list NAMES that match PAT."""
      result = []
      pat = os.path.normcase(pat)
      match = _compile_pattern(pat)
      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
function_tokens: def filter ( names , pat ) : result = [ ] pat = os . path . normcase ( pat ) match = _compile_pattern ( pat ) 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