Parse query string, but enforce one instance of each variable.
        Return a dict with the variables on success
        Return None on parse error
16765
def parse_qs(self, qs):
        
        qs_state = urllib2.urlparse.parse_qs(qs)
        ret = {}
        for qs_var, qs_value_list in qs_state.items():
            if len(qs_value_list) > 1:
                return None

            ret[qs_var] = qs_value_list[0]

        return ret
216859
def parse_query(str)
      query = Hash.new
      if str
        str.split(/[&;]/).each{|x|
          next if x.empty?
          key, val = x.split(/=/,2)
          key = unescape_form(key)
          val = unescape_form(val.to_s)
          val = FormData.new(val)
          val.name = key
          if query.has_key?(key)
            query[key].append_data(val)
            next
          end
          query[key] = val
        }
      end
      query
    end
75867
def parse_vars(self, args):
        
        result = {}
        for arg in args:
            if '=' not in arg:
                raise ValueError(
                    'Variable assignment %r invalid (no "=")'
                    % arg)
            name, value = arg.split('=', 1)
            result[name] = value
        return result
360864
def get_safe_variables(self,query,var_dict):
        '''  '''

        variables_bounded_to_constants = []

        for constraint in query.constraints:
            if (constraint.get_left_side().is_variable() and
                constraint.get_right_side().is_constant() and
                constraint.is_equality_constraint()):
                    variables_bounded_to_constants.append(constraint.get_left_side())

        safe_variables = list(var_dict) + variables_bounded_to_constants

        return safe_variables
79840
def parse_cookie(self, string):
        '''
        
        '''
        results = re.findall('([^=]+)=([^\;]+);?\s?', string)
        my_dict = {}
        for item in results:
            my_dict[item[0]] = item[1]

        return my_dict
678240
def url(self, var, default=NOTSET):
        
        return self.get_value(var, cast=urlparse, default=default, parse_default=True)
885580
def parse_values(self, query):
        
        values = {}
        for name, filt in self.filters.items():
            val = filt.parse_value(query)
            if val is None:
                continue
            values[name] = val
        return values
1078920
def parse_qs(string):
    """"""
    result = {}

    for item in split_qs(string):
        # Split the query string by unquotes ampersants ('&')
        try:
            # Split the item by unquotes equal signs
            key, value = split_qs(item, delimiter='=')
        except ValueError:
            # Single value without equals sign
            result[item] = ''
        else:
            result[key] = value

    return result
784149
def gql(query_string, *args, **kwds):
  
  qry = _gql(query_string)
  if args or kwds:
    qry = qry._bind(args, kwds)
  return qry
1042250
def dict(self, var, default=NOTSET, cast=None, force=True):
        
        return self._get(var, default=default, cast={str: cast}, force=force)
372781
def parse_querystring(self, req, name, field):
        """"""
        return core.get_value(req.args, name, field)
142228
def get_query(path, force_unicode=True):
    
    u = urlparse(path)
    if not u.query:
        return {}
    p = parse_qs(u.query)

    if force_unicode:
        p = _unicode(p)
    return p
1374273
def querystring(self):
        
        return {key: value for (key, value) in self.qs.items()
                if key.startswith(self.MANAGED_KEYS) or self._get_key_values('filter[')}
1347434
def query_str_2_dict(query_str):
    
    if query_str:
        query_list = query_str.split('&')
        query_dict = {}
        for t in query_list:
            x = t.split('=')
            query_dict[x[0]] = x[1]
    else:
        query_dict = {}
    return query_dict
54406
def get_vars(self):
		
		if self.method() != 'GET':
			raise RuntimeError('Unable to return get vars for non-get method')
		re_search = WWebRequestProto.get_vars_re.search(self.path())
		if re_search is not None:
			return urllib.parse.parse_qs(re_search.group(1), keep_blank_values=1)
1282001
def from_raw_query(cls, query_string):
        
        try:
            node_tree = grammar.parse(query_string)
        except IncompleteParseError:
            query_string = cls.fix_quotes(query_string)
            node_tree = grammar.parse(query_string)

        structured_query = DictFormater().visit(node_tree)

        return cls([t for t in structured_query
                    if t[1].lower() not in STOPWORDS])
168876
def post_vars(self):
		
		if self.method() != 'POST':
			raise RuntimeError('Unable to return post vars for non-get method')

		content_type = self.content_type()
		if content_type is None or content_type.lower() != 'application/x-www-form-urlencoded':
			raise RuntimeError('Unable to return post vars with invalid content-type request')

		request_data = self.request_data()
		request_data = request_data.decode() if request_data is not None else ''
		re_search = WWebRequestProto.post_vars_re.search(request_data)
		if re_search is not None:
			return urllib.parse.parse_qs(re_search.group(1), keep_blank_values=1)