Generate URL for a Taskcluster exchange reference.
971494
def exchange_reference(root_url, service, version):
    """"""
    root_url = root_url.rstrip('/')
    if root_url == OLD_ROOT_URL:
        return 'https://references.taskcluster.net/{}/{}/exchanges.json'.format(service, version)
    else:
        return '{}/references/{}/{}/exchanges.json'.format(root_url, service, version)
120778
def _generate_url(self, resource, query_params=None):
        
        resource = '{resource}?token={token}'.format(resource=resource, token=self.token)
        if query_params:
            resource += "&{}".format(urlencode(query_params))
        return self.base_url_template.format(resource)
1343378
def generate_item_urls(self):
        """"""
        item_urls = {}
        for i in self.dataset.identifiers:
            relpath = self.dataset.item_properties(i)["relpath"]
            url = self.generate_url("data/" + relpath)
            item_urls[i] = url
        return item_urls
1136652
def resource_to_url(resource, request=None, quote=False):
    
    if request is None:
        request = get_current_request()
#    cnv = request.registry.getAdapter(request, IResourceUrlConverter)
    reg = get_current_registry()
    cnv = reg.getAdapter(request, IResourceUrlConverter)
    return cnv.resource_to_url(resource, quote=quote)
771580
def build_url(self):
        
        url = '{protocol}/{url}/{rest}/{version}/{restapi}/{rscpath}/' \
              '{query}'.format(protocol=self.schema.protocol,
                               url=self.schema.main_url,
                               rest=self.schema.rest,
                               version=self.schema.version,
                               restapi=self.schema.restApi,
                               rscpath=self.schema.resourcePath,
                               query=self.schema.query)
        return url.replace('/None/', '/')
106692
private static String getOrGenerateServiceLabel(QuerySolution row) {
        String label = getServiceLabel(row);
        if (label == null) {
            URL svcUrl = getServiceUrl(row);
            label = URIUtil.generateItemLabel(svcUrl);
        }

        return label;
    }
1197178
def __assembleURL(self, url, groupId):
        """"""
        from ..packages.six.moves.urllib_parse import urlparse
        parsed = urlparse(url)
        communityURL = "%s://%s%s/sharing/rest/community/groups/%s" % (parsed.scheme, parsed.netloc,
                                                                        parsed.path.lower().split('/sharing/rest/')[0],
                                                                        groupId)
        return communityURL
860427
def base_url(self, value):
        """"""
        logger.debug('StackInABox({0}): Updating URL from {1} to {2}'
                     .format(self.__id, self.__base_url, value))
        self.__base_url = value
        for k, v in six.iteritems(self.services):
            matcher, service = v
            service.base_url = StackInABox.__get_service_url(value,
                                                             service.name)
            logger.debug('StackInABox({0}): Service {1} has url {2}'
                         .format(self.__id, service.name, service.base_url))
39746
def url(self):
        
        endpoint = 'taskinfo?taskID=%d' % self.id
        return posixpath.join(self.connection.weburl, endpoint)
1055021
def url(self, host):
        """"""
        path = '/'.join(str(v) for v in self._path)
        return 'coaps://{}:5684/{}'.format(host, path)
559252
def _buildUrl(self):
		""""""
		return '%(protocol)s://%(host)s:%(port)s%(address)s'%{
			'protocol': self._protocol,
			'host': self._host,
			'port': self._port,
			'address': self._address,
		}
7723
def get_exchange(self, vhost, name):
        
        vhost = quote(vhost, '')
        name = quote(name, '')
        path = Client.urls['exchange_by_name'] % (vhost, name)
        exch = self._call(path, 'GET')
        return exch
518207
def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs):
        

        if public:
            environment_slug = ""
            if environment_id is not None:
                environment_slug = "/environments/{0}".format(environment_id)
            return "spaces/{0}{1}/public/content_types".format(space_id, environment_slug)
        return super(ContentType, klass).base_url(
            space_id,
            resource_id=resource_id,
            environment_id=environment_id,
            **kwargs
        )
996703
def resource_url(self):
        """"""
        if self._iam:
            self._resource_url = self._resource_url or _get_iam_rest_api_url_from_creds(self.rest_client, self.credentials)
        else:
            self._resource_url = self._resource_url or _get_rest_api_url_from_creds(self.session, self.credentials)
        return self._resource_url
1253123
def base_url(self):
        """"""

        if self.doc.package_url:
            return self.doc.package_url

        return self.doc._ref
940045
def _initURL(self, org_url=None,
                 token_url=None,
                 referer_url=None):
        
        if org_url is not None and org_url != '':
            if not org_url.startswith('http://') and not org_url.startswith('https://'):
                org_url = 'http://' + org_url
            self._org_url = org_url
        if not self._org_url.startswith('http://') and not self._org_url.startswith('https://'):
            self._org_url = 'http://' + self._org_url

        if self._org_url.lower().find('/sharing/rest') > -1:
            self._url = self._org_url
        else:
            self._url = self._org_url + "/sharing/rest"

        if self._url.startswith('http://'):
            self._surl = self._url.replace('http://', 'https://')
        else:
            self._surl  =  self._url

        if token_url is None:

            results = self._get(url= self._surl + '/info',
                                   param_dict={'f':'json'},
                                   proxy_port=self._proxy_port,
                                   proxy_url=self._proxy_url)
            if 'authInfo' in results and 'tokenServicesUrl' in results['authInfo']:

                self._token_url = results['authInfo']['tokenServicesUrl']
            else:
                self._token_url = self._surl  + '/generateToken'

        else:
            self._token_url = token_url
        parsed_url = urlparse(self._org_url)
        self._parsed_org_url = urlunparse((parsed_url[0],parsed_url[1],"","","",""))

        if referer_url is None:
            self._referer_url = parsed_url.netloc
1184754
public static URL getURL(String confName, ClassLoader classLoader, Class cls) {
        URL url = null;
        
        // User home 
        String userHome = System.getProperty( "user.home" );
        if ( userHome.endsWith( "\\" ) || userHome.endsWith( "/" ) ) {
            url = getURLForFile( userHome + confName );
        } else {
            url = getURLForFile( userHome + "/" + confName );
        }

        // Working directory             
        if ( url == null ) {
            url = getURLForFile( confName );
        }
        
        // check Class folder
        if ( cls != null ) {
            URL urlResource = cls.getResource( confName );
            if (urlResource != null) {
                url = urlResource;
            }
        }

        // check META-INF directories for all known ClassLoaders
        if ( url == null && classLoader != null ) {
            ClassLoader confClassLoader = classLoader;
            if ( confClassLoader != null ) {
                url = confClassLoader.getResource( "META-INF/" + confName );
            }
        }

        if ( url == null ) {
            ClassLoader confClassLoader = ConfFileUtils.class.getClassLoader();
            if ( confClassLoader != null && confClassLoader != classLoader ) {
                url = confClassLoader.getResource( "META-INF/" + confName );
            }
        }
        
        if ( url == null && cls != null ) {
            ClassLoader confClassLoader = cls.getClassLoader();
            if ( confClassLoader != null && confClassLoader != classLoader ) {
                url = confClassLoader.getResource( "META-INF/" + confName );
            }
        }

        if ( url == null ) {
            ClassLoader confClassLoader = Thread.currentThread().getContextClassLoader();
            if ( confClassLoader != null && confClassLoader != classLoader ) {
                url = confClassLoader.getResource( "META-INF/" + confName );
            }
        }

        if ( url == null ) {
            ClassLoader confClassLoader = ClassLoader.getSystemClassLoader();
            if ( confClassLoader != null && confClassLoader != classLoader ) {
                url = confClassLoader.getResource( "META-INF/" + confName );
            }
        }

        return url;
    }