Sets the +query+ from +url+. Raises an +ArgumentError+ unless the +url+ is valid.
498503
def query=(query)
      raise ArgumentError, "Invalid URL: #{self.url}" unless self.url.respond_to?(:query)
      if query.kind_of?(Hash)
        query = build_query_from_hash(query)
      end
      query = query.to_s unless query.is_a?(String)
      self.url.query = query
    end
1050810
def execute(self, query, args=None):
        
        self._ensure_conn()
        cur = self._conn.cursor()
        yield cur.execute(query, args)
        raise Return(cur)
40402
def urlencode(query, params):
    
    return query + '?' + "&".join(key+'='+quote_plus(str(value)) 
                                  for key, value in params)
132816
def preserve_builtin_query_params(url, request=None):
    
    if request is None:
        return url

    overrides = [
        api_settings.URL_FORMAT_OVERRIDE,
    ]

    for param in overrides:
        if param and (param in request.GET):
            value = request.GET[param]
            url = replace_query_param(url, param, value)

    return url
88532
def add_params_to_qs(query, params):
    """"""
    if isinstance(params, dict):
        params = params.items()
    queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
    queryparams.extend(params)
    return urlencode(queryparams)
512470
def add_query_parameters_to_url(url, query_parameters):
    
    # Parse the given URL into parts.
    url_parts = urllib.parse.urlparse(url)

    # Parse existing parameters and add new parameters.
    qs_args = urllib.parse.parse_qs(url_parts[4])
    qs_args.update(query_parameters)

    # Sort parameters to ensure consistent order.
    sorted_qs_args = OrderedDict()
    for k in sorted(qs_args.keys()):
        sorted_qs_args[k] = qs_args[k]

    # Encode the new parameters and return the updated URL.
    new_qs = urllib.parse.urlencode(sorted_qs_args, True)
    return urllib.parse.urlunparse(list(url_parts[0:4]) + [new_qs] + list(url_parts[5:]))
396898
def add_params_to_url(url, params):
    
    url_parts = list(urlparse.urlparse(url))  # get url parts
    query = dict(urlparse.parse_qsl(url_parts[4]))  # get url query
    query.update(params)  # add new params
    url_parts[4] = urlencode(query)
    return urlparse.urlunparse(url_parts)
762742
def set_url (self, url):
        """"""
        self.url = url
        self.host, self.path = urlparse.urlparse(url)[1:3]
240796
def set_search_url(self, url):
        

        self.__init__()

        if url[0] == '?':
            url = url[1:]

        args = parse_qs(url)

        # urldecode keywords
        for arg in args['q']:
            self.searchterms += [ unquote(i) for i in arg.split(" ") ]
        del args['q']

        for key, value in args.items():
            self.arguments.update({key: unquote(value[0])})

        # look for advanced operators: attitudes
        for attitude in self._attitudes:
            try:
                i = self.searchterms.index(attitude)
                del self.searchterms[i]
                self.attitude_filter = (i == 1)
            except ValueError:
                pass

        # look for advanced operators: question
        try:
            del self.searchterms[ self.searchterms.index(self._question) ]
            self.question_filter = True
        except ValueError:
            pass

        # look for advanced operators: link-filter
        try:
            del self.searchterms[ self.searchterms.index(self._link) ]
            self.link_filter = True
        except ValueError:
            pass



        # look for advanced operators: source-filter
        i = None
        for element in self.searchterms:
            if element.startswith(self._source):
                i = element
                break
        if i:
            del self.searchterms[ self.searchterms.index(i) ]
            self.source_filter = i[ len(self._source): ]
1205357
def query(self, value=None):
        
        if value is not None:
            return URL._mutate(self, query=value)
        return self._tuple.query
225654
def _set_query_data(self, action='query'):
        
        data = self._load_response(action)
        page = data['query']['pages'][0]

        self._handle_continuations(data, action)

        if action == 'query':
            self.data['random'] = data['query']['random'][0]["title"]

        self._extend_data('backlinks', data['query'].get('backlinks'))

        self.data['redirected'] = data['query'].get('redirects')

        self._set_query_data_fast_1(page)  # avoid pylint too-many-branches
        self._set_query_data_fast_2(page)
        self._set_query_data_slow(page)
1199741
def fromurl(url):
  
  ps = PatchSet( urllib_request.urlopen(url) )
  if ps.errors == 0:
    return ps
  return False
416692
public UrlBuilder withQuery(String query) {
        if (query == null || query.isEmpty()) {
            this.query.clear();
        } else {
            with(query, UrlTokenizerState.QUERY);
        }
        return this;
    }
759202
def change_url_query_params(url, params):
    
    url_parts = list(urlparse.urlparse(url))
    query = dict(urlparse.parse_qsl(url_parts[4]))
    query.update(params)
    url_parts[4] = urllib.urlencode(encode_url_query_params(query))
    return urlparse.urlunparse(url_parts)
1076806
def setQuery(self, query):
        
        if not self.isVisible():
            self._loadQuery = query
        else:
            self._loadQuery = None
            
            if self._initialized and hash(query) == hash(self.query()):
                return
            
            self._initialized = True
            self.clear()
            self.addContainer(query)
919124
def send(self, request, **kwargs):
        
        if len(request.url) > self.MAX_URL_LENGTH:
            raise URITooLong(
                message=(
                    'Request url too large, '
                    'likely too many query parameters provided.'
                )
            )
        return super(RequestSession, self).send(request, **kwargs)
822549
def resolve_url_ext(to, params_=None, anchor_=None, args=None, kwargs=None):
    
    url = resolve_url(to, *(args or ()), **(kwargs or {}))
    if params_:
        url += '?' + urllib.urlencode(encode_url_query_params(params_))
    if anchor_:
        url += '#' + anchor_
    return url