Make the given (relative) URL absolute.

        Args:
            base (str): The absolute URL the relative url was found on.
            relative (str): The (possibly relative) url to make absolute.

        Returns:
            str: The absolute URL.
329036
def make_absolute(base, relative):
        

        # Python 3.4 and lower do not remove folder traversal strings.
        # This was fixed in 3.5 (https://docs.python.org/3/whatsnew/3.5.html#urllib)
        while relative.startswith('/../') or relative.startswith('../'):
            relative = relative[3:]

            base_parsed = urlparse(base)
            new_path = base_parsed.path.rsplit('/', 1)[0]
            base_parsed = base_parsed._replace(path=new_path)
            base = base_parsed.geturl()

        return urljoin(base, relative)
746932
def make_relative(base, obj):
    """"""
    uri = obj.get("location", obj.get("path"))
    if ":" in uri.split("/")[0] and not uri.startswith("file://"):
        pass
    else:
        if uri.startswith("file://"):
            uri = uri_file_path(uri)
            obj["location"] = os.path.relpath(uri, base)
393553
def url(self, action, **kwargs):
        
        # TODO : should be static method ?
        return self.URLS['BASE'] % self.URLS[action] % kwargs
103998
def base_url(root):
    """"""
    for attr, value in root.attrib.iteritems():
        if attr.endswith('base') and 'http' in value:
            return value
    return None
407124
def to_absolute(link)
      return nil if link.nil?

      # remove anchor
      link = URI.encode(URI.decode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,'')))

      relative = URI(link)
      absolute = base ? base.merge(relative) : @url.merge(relative)

      absolute.path = '/' if absolute.path.empty?

      return absolute
    end
1027552
def base
      @base = if doc
                href = doc.search('//head/base/@href')
                URI(href.to_s) unless href.nil? rescue nil
              end unless @base

      return nil if @base && @base.to_s.empty?
      @base
    end
80678
def create_basic_url(self):
        
        if self.username is None:
            if self.namespace is None:
                request_url = "{}/api/0/{}/".format(
                    self.instance, self.repo)
            else:
                request_url = "{}/api/0/{}/{}/".format(
                    self.instance, self.namespace, self.repo)
        else:
            if self.namespace is None:
                request_url = "{}/api/0/fork/{}/{}/".format(
                    self.instance, self.username, self.repo)
            else:
                request_url = "{}/api/0/fork/{}/{}/{}/".format(
                    self.instance, self.username, self.namespace, self.repo)
        return request_url
542107
def get_base_url(use_ssl, instance=None, host=None):
        

        if instance is not None:
            host = ("%s.service-now.com" % instance).rstrip('/')

        if use_ssl is True:
            return "https://%s" % host

        return "http://%s" % host
713294
def build_absolute_uri(request, relative_url):
    """"""
    webroot = getattr(settings, 'WEBROOT', '')
    if webroot.endswith("/") and relative_url.startswith("/"):
        webroot = webroot[:-1]

    return request.build_absolute_uri(webroot + relative_url)
543283
def get_abs_url(self, rel_url):
        
        rel_url = rel_url.lstrip("/")
        return "{}://{}:{}/{}".format(self.url_scheme, self.host, self.port, rel_url)
1334781
def base_url(self, url):
        """"""
        parts = list(self.parse_url(url))
        parts[4:] = ['' for i in parts[4:]]
        return urlunparse(parts)
890606
public function setBaseUrl($base_url) {
        $this->base_url = '/' . trim($base_url, '/') . '/';
        $this->base_url = str_replace('//', '/', $this->base_url);

        return $this;
    }
668403
def url(self, name, *, base=None, query=None, **match):
        
        return self.__router.url(name, base=base, query=query, **match)
1234385
def get_absolute_url(self):
        
        try:
            node = Node.objects.select_related().filter(page=self)[0]
            return node.get_absolute_url()
        except Exception, e:
            raise ValueError(u"Error in {0}.{1}: {2}".format(self.__module__, self.__class__.__name__, e))
            return u""
1139686
def _new_url(self, relative_url):
        """"""

        return Url(
            urljoin(self._base_url, relative_url),
            **self._default_kwargs
        )
691156
def _build_url(self, endpoint):
        
        try:
            path = self.endpoints[endpoint]
        except KeyError:
            msg = 'Unknown endpoint `{0}`'
            raise ValueError(msg.format(endpoint))
        absolute_url = urljoin(self.target, path)
        return absolute_url
1257537
def _construct_url(self, base_api, params):
        
        params['key'] = self.api_key
        return super(PickPoint, self)._construct_url(base_api, params)