Construct url for route with additional params.
964853
def url_for(self, *args: str, **kwargs: str) -> URL:
        """"""
        return self._resource.url_for(*args, **kwargs)
99868
def build_url(self, *args, **kwargs):
        """"""
        parts = [kwargs.get('base_url') or self.base_url]
        parts.extend(args)
        parts = [str(p) for p in parts]
        key = tuple(parts)
        __logs__.info('Building a url from %s', key)
        if not key in __url_cache__:
            __logs__.info('Missed the cache building the url')
            __url_cache__[key] = '/'.join(parts)
        return __url_cache__[key]
1125551
def match_route(self, reqpath):
        """"""
        route_dicts = [routes for _, routes in self.api.http.routes.items()][0]
        routes = [route for route, _ in route_dicts.items()]
        if reqpath not in routes:
            for route in routes:  # replace params in route with regex
                reqpath = re.sub('^(/v\d*/?)', '/', reqpath)
                base_url = getattr(self.api.http, 'base_url', '')
                reqpath = reqpath.replace(base_url, '', 1) if base_url else reqpath
                if re.match(re.sub(r'/{[^{}]+}', r'/[\\w-]+', route) + '$', reqpath):
                    return route

        return reqpath
1257537
def _construct_url(self, base_api, params):
        
        params['key'] = self.api_key
        return super(PickPoint, self)._construct_url(base_api, params)
61154
def url_for(params)
      host_with_port = host || location.host
      host_with_port += ":#{port}" if port && port != 80
      scheme = scheme || location.scheme

      unless RUBY_PLATFORM == 'opal'
        # lazy load routes and views on the server
        if !@router && @routes_loader
          # Load the templates
          @routes_loader.call
        end
      end

      path, params = @router.params_to_url(params)

      if path == nil
        raise "No route matched, make sure you have the base route defined last: `client '/', {}`"
      end

      new_url    = "#{scheme}://#{host_with_port}#{path.chomp('/')}"

      # Add query params
      params_str = ''
      unless params.empty?
        query_parts = []
        nested_params_hash(params).each_pair do |key, value|
          # remove the _ from the front
          value = Volt::Parsing.encodeURI(value)
          query_parts << "#{key}=#{value}"
        end

        if query_parts.size > 0
          query = query_parts.join('&')
          new_url += "?#{query}"
        end
      end

      # Add fragment
      frag    = fragment
      new_url += '#' + frag if frag.present?

      new_url
    end
628863
def _construct_url(self, endpoint):
        """"""
        parsed_url = urlparse(self.host)
        scheme = parsed_url[0]
        host = parsed_url[1]
        # Handle host without a scheme specified (eg. www.example.com)
        if scheme == "":
            scheme = "http"
            host = self.host

        if not endpoint.startswith("/"):
            endpoint = "/" + endpoint
        if self.config["api_version"] is not None:
            endpoint = "/v%d%s" % (self.config["api_version"], endpoint)
        return urlunparse((scheme, host, endpoint, '', '', ''))
35116
def _BuildUrl(self, url, path_elements=None, extra_params=None):
        
        # Break url into constituent parts
        (scheme, netloc, path, params, query, fragment) = urlparse(url)

        # Add any additional path elements to the path
        if path_elements:
            # Filter out the path elements that have a value of None
            p = [i for i in path_elements if i]
            if not path.endswith('/'):
                path += '/'
            path += '/'.join(p)

        # Add any additional query parameters to the query string
        if extra_params and len(extra_params) > 0:
            extra_query = self._EncodeParameters(extra_params)
            # Add it to the existing query
            if query:
                query += '&' + extra_query
            else:
                query = extra_query

        # Return the rebuilt URL
        return urlunparse((scheme, netloc, path, params, query, fragment))
957536
function buildRouterPath(path, prefix) {
	if (!prefix) {
		prefix = '';
	}

	if (prefix.length && path === '/') {
		return prefix;
	}

	return prefix + path;
}
808966
def _build_url(self, host, sport, method, id, format, parameters):
        
        path = "/".join(filter(None, (sport, method, id)))
        url = "https://" + host + "/" + path + "." + format
        if parameters:
            paramstring = urllib.parse.urlencode(parameters)
            url = url + "?" + paramstring
        return url
144189
public function url($route, $params)
    {
        // use array filter to remove keys with null values
        $params += array_filter($this->getEmbedParams());

        return $this->router->generate($route, $params);
    }
441258
def _add_route(self, method, path, middleware=None):
        """"""
        if middleware is not None:
            self.add(method, path, middleware)
            return self
        else:
            # return a lambda that will return the 'func' argument
            return lambda func: (
                self.add(method, path, func),
                func
            )[1]
608510
protected function createUrlDefault($route, $params, $ampersand)
    {
        if ($this->urlFormat === self::PATH_FORMAT) {
            $url = rtrim($this->getBaseUrl() . '/' . $route, '/');
            if ($this->appendParams) {
                $url = rtrim($url . '/' . $this->createPathInfo($params, '/', '/'), '/');
                return $route === '' ? $url : $url . $this->urlSuffix;
            } else {
                if ($route !== '') {
                    $url .= $this->urlSuffix;
                }
                $query = $this->createPathInfo($params, '=', $ampersand);
                return $query === '' ? $url : $url . '?' . $query;
            }
        } else {
            $url = $this->getBaseUrl();
            if (!$this->showScriptName) {
                $url .= '/';
            }
            if ($route !== '') {
                $url .= '?' . $this->routeVar . '=' . $route;
                if (($query = $this->createPathInfo($params, '=', $ampersand)) !== '') {
                    $url .= $ampersand . $query;
                }
            } elseif (($query = $this->createPathInfo($params, '=', $ampersand)) !== '') {
                $url .= '?' . $query;
            }
            return $url;
        }
    }
816506
def url_for params
      p = params.dup
      query = p.map{|key, value| value.to_query(key) } * '&'
      "#{h.url_for({})}?#{query}"
    end
290381
function(route) {
      route = route.replace(escapeRegExp, '\\$&')
                   .replace(optionalParam, '(?:$1)?')
                   .replace(namedParam, function(match, optional){
                     return optional ? match : '([^\/]+)';
                   })
                   .replace(splatParam, '(.*?)');
      return new RegExp('^' + route + '$');
    }
1123365
def routing(routes, request):
    """"""

    # strip trailing slashes from request path
    path = request.path.strip('/')

    # iterate through routes to match
    args = {}
    for name, route in routes.items():
        if route['path'] == '^':
            # this section exists because regex doesn't work for null character as desired
            if path == '':
                match = [True]
            else:
                match = []
        else:
            match = re.findall(route['path'], path)
        
        if match:
            # found the matching url, iterate through variables to pass data
            # check if method exists
            if not request.method in route['method']:
                raise TornMethodNotAllowed
            
            values = match[0] # in form of tuples
            if type(values) != bool:
                for i in range(len(route['variables'])):
                    # if value is blank, check if default exists and pass it instead
                    if type(values) == str:
                        args[route['variables'][i]] = values
                    else:
                        if not values[i] and route['variables'][i] in route['defaults']:
                            values[i] = route['defaults'][route['variables'][i]]
                        args[route['variables'][i]] = values[i]
            
            # we have the variables we need, args, path, controller
            return {
                'kwargs'        : args,
                'controller'    : route['controller']
            }
    raise TornNotFoundError
446525
def _construct_url(self, url, base, quote):
        
        if not base and not quote:
            return url
        else:
            url = url + base.lower() + quote.lower() + "/"
            return url
507334
private URL buildUriWithParameters(URL url, Map<String, String> params) throws URISyntaxException, MalformedURLException {
        if (params == null || params.isEmpty()) {
            return url;
        }
        URIBuilder uriBuilder = new URIBuilder(url.toURI());
        for (String paramName : params.keySet()) {
            uriBuilder.addParameter(paramName, params.get(paramName));
        }
        return uriBuilder.build().toURL();
    }