def build_queries_from(f, regex, cap_types, cap_pr, encoding=u'ascii'):
 queries = []
 for line in f:
  matches = regex.match(line)
  if matches:
   query = reorder_to(list(zip(matches.groups(), cap_types)), cap_pr)
   queries.append(query)
 return queries

def build_queries_from ( f , regex , cap_types , cap_pr , encoding = u'ascii' ) : queries = [ ] for line in f : matches = regex . match ( line ) if matches : query = reorder_to ( list ( zip ( matches . groups ( ) , cap_types ) ) , cap_pr ) queries . append ( query ) return queries
returns a list of queries from the given file .