join a list of url elements, and include any keyword arguments, as a new URL
557638
def join(C, *args, **kwargs):
        """"""
        u = C('/'.join([str(arg).strip('/') for arg in args]), **kwargs)
        return u
664124
def from_url(cls, url, **kwargs):
        
        doc = {
            "clusters": [
                {
                    "name": "self",
                    "cluster": {
                        "server": url,
                    },
                },
            ],
            "contexts": [
                {
                    "name": "self",
                    "context": {
                        "cluster": "self",
                    },
                }
            ],
            "current-context": "self",
        }
        self = cls(doc, **kwargs)
        return self
933070
function appendQueryString(url, params){
        var key;
        url = url || '';
        if(params){
            if(url.indexOf('?') === -1){
                url += '?';
            }
            if(typeof params === 'string'){
                url += params;
            } else if (typeof params === 'object'){
                for(key in params){
                    if(!/[?&]$/.test(url)){
                        url += '&';
                    }
                    url += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
                }
            }
        }

        return url;
    }
1331002
def _url_chunk_join(self, *args):
        """"""
        # Strip slashes from either side of each path piece.
        pathlets = map(lambda s: s.strip('/'), args)
        # Remove empty pieces.
        pathlets = filter(None, pathlets)
        url = '/'.join(pathlets)
        # If this is a directory, add a trailing slash.
        if args[-1].endswith('/'):
            url = '%s/' % url
        return url
792785
function appendUrls(url, arr){
			var i = arr.length,
				found = false;
			while (i--) {
			    if(arr[i] === url){
			    	found = true;
			    	break;
			    }
			}
			if(!found) arr.push(url);
		 }
1063012
def make_url(invocation, args=[], kwargs={}):
    
    if not invocation.endswith('/'):
        invocation += '/'
    if not invocation.startswith('/'):
        invocation = '/' + invocation

    url = invocation

    for arg in args:
        url += str(arg) + "/"

    if kwargs:
        url = url[:-1]
        url += "?" + urlencode(kwargs)
    
    return url
373976
def url(self, version=None, **kwargs):
        """"""
        for url in self.urls(version):
            if [key for key in kwargs.keys() if not '{' + key + '}' in url]:
                continue

            return url.format(**kwargs)

        raise KeyError('URL that takes all provided parameters not found')
1236067
def insert_from_urls(urls, contenthandler, **kwargs):
	
	verbose = kwargs.get("verbose", False)

	#
	# load documents
	#

	for n, url in enumerate(urls, 1):
		if verbose:
			print >>sys.stderr, "%d/%d:" % (n, len(urls)),
		insert_from_url(url, contenthandler = contenthandler, **kwargs)

	#
	# done.  build indexes
	#

	dbtables.build_indexes(contenthandler.connection, verbose)
244703
def add(self, urls):
        

        if isinstance(urls, (list, tuple)):
            self.urls.extend(urls)
        elif isinstance(urls, basestring):
            self.urls.append(urls)
        elif isinstance(urls, QuerySet):
            for obj in urls:
                self.urls.append(obj.get_absolute_url())
        elif hasattr(urls, 'get_absolute_url'):
            self.urls.append(urls.get_absolute_url())
        else:
            raise TypeError("Don't know how to handle %r" % urls)
632408
@Pure
	public static URL join(URL urlBase, File... elements) {
		if (urlBase == null) {
			return null;
		}
		final StringBuilder buf = new StringBuilder(urlBase.getPath());
		for (final File elt : elements) {
			if (!elt.isAbsolute() && (buf.length() == 0 || buf.charAt(buf.length() - 1) != URL_PATH_SEPARATOR_CHAR)) {
				buf.append(URL_PATH_SEPARATOR_CHAR);
			}
			buf.append(fromFileStandardToURLStandard(elt));
		}
		try {
			if (isJarURL(urlBase)) {
				return new URL(
						urlBase.getProtocol(),
						urlBase.getHost(),
						urlBase.getPort(),
						buf.toString());
			}
			return new URI(
					urlBase.getProtocol(),
					urlBase.getUserInfo(),
					urlBase.getHost(),
					urlBase.getPort(),
					decodeHTMLEntities(buf.toString()),
					decodeHTMLEntities(urlBase.getQuery()),
					urlBase.getRef()).toURL();
		} catch (Throwable exception) {
			//
		}
		try {
			return new URL(
					urlBase.getProtocol(),
					urlBase.getHost(),
					buf.toString());
		} catch (Throwable exception) {
			return null;
		}
	}
898084
def urljoin(end_with_slash, *args):
        
        last = args[0]
        for i in args[1:]:
            last = '%s/%s' % (last.strip('/'), i.strip('/'))

        if end_with_slash:
            if last[-1] != '/':
                last += '/'
        return last
494802
def args_to_search_url(arguments)
      query = if arguments[:query].kind_of? Hash
        #multi-field
        arguments[:query].collect {|field, query_value| fielded_query(query_value, field)}.join(" ")
      elsif arguments[:search_field]
        fielded_query(arguments[:query], arguments[:search_field])
      else
        arguments[:query]
      end

      query_url = base_url + "volumes?q=#{CGI.escape  query}"
      if configuration.api_key
        query_url += "&key=#{configuration.api_key}"
      end

      if arguments[:per_page]
        query_url += "&maxResults=#{arguments[:per_page]}"
      end
      if arguments[:start]
        query_url += "&startIndex=#{arguments[:start]}"
      end

      if arguments[:sort] &&
          (defn = sort_definitions[arguments[:sort]]) &&
          (value = defn[:implementation])
        query_url += "&orderBy=#{CGI.escape(value)}"
      end


      return query_url
    end
123959
def urljoin(*urls):
    
    return reduce(urlparse.urljoin, [u.strip('/')+'/' for u in urls if u.strip('/')], '').rstrip('/')
1167188
def add_url(self, *args, **kwargs):
        
        if len(args) == 1 and not kwargs and isinstance(args[0], UrlEntry):
            self.urls.append(args[0])
        else:
            self.urls.append(UrlEntry(*args, **kwargs))
1194549
def __append_url_params(self, url, params):
    """"""
    url_parts = list(urlparse(url))
    query = dict(parse_qsl(url_parts[4]))
    query.update(params)
    url_parts[4] = urlencode(query)

    return urlunparse(url_parts)
1116121
def buildURL(self, action, **query):
        """"""
        base = urlparse.urljoin(self.server.base_url, action)
        return appendArgs(base, query)
747744
def join_url_parts(*args):
    
    # check for edge case
    if len(args) == 1:
        return args[0]

    return_val = clean_url_segment(args[0])

    for i in range(1, len(args)):
        arg = args[i]

        if i == len(args) - 1:
            # no need to remove a trailing slash if this is the last segment
            return_val += '/' + arg
        else:
            # remove a trailing slash so it won't be duplicated
            return_val += '/' + clean_url_segment(arg)

    return return_val