def parse_query_parts(parts, model_cls):
 prefixes = {':': dbcore.query.RegexpQuery}
 prefixes.update(plugins.queries())
 if ('path' in model_cls._fields):
  path_parts = []
  non_path_parts = []
  for s in parts:
   if (s.find(os.sep, 0, s.find(':')) != (-1)):
    path_parts.append(s)
   else:
    non_path_parts.append(s)
 else:
  path_parts = ()
  non_path_parts = parts
 (query, sort) = dbcore.parse_sorted_query(model_cls, non_path_parts, prefixes)
 if path_parts:
  query.subqueries += [PathQuery('path', s) for s in path_parts]
 return (query, sort)

def parse_query_parts ( parts , model_cls ) : prefixes = { ':' : dbcore . query . RegexpQuery } prefixes . update ( plugins . queries ( ) ) if ( 'path' in model_cls . _fields ) : path_parts = [ ] non_path_parts = [ ] for s in parts : if ( s . find ( os . sep , 0 , s . find ( ':' ) ) != ( - 1 ) ) : path_parts . append ( s ) else : non_path_parts . append ( s ) else : path_parts = ( ) non_path_parts = parts ( query , sort ) = dbcore . parse_sorted_query ( model_cls , non_path_parts , prefixes ) if path_parts : query . subqueries += [ PathQuery ( 'path' , s ) for s in path_parts ] return ( query , sort )
given a beets query string as a list of components .