Grabs the first URL out of a asn1crypto.x509.CRLDistributionPoints
        object

        :param distribution_points:
            The x509.CRLDistributionPoints object to pull the URL out of

        :return:
            A unicode string or None
978819
def _get_crl_url(self, distribution_points):
        

        if distribution_points is None:
            return None

        for distribution_point in distribution_points:
            name = distribution_point['distribution_point']
            if name.name == 'full_name' and name.chosen[0].name == 'uniform_resource_identifier':
                return name.chosen[0].chosen.native

        return None
137689
def sha1(self):
        

        if self._sha1 is None:
            self._sha1 = hashlib.sha1(self.dump()).digest()
        return self._sha1
817672
def get_distribution_path(catalog_id, dataset_id, distribution_id,
                          distribution_file_name, catalogs_dir=CATALOGS_DIR,
                          use_short_path=False):
    """"""
    if use_short_path:
        distribution_dir = get_distribution_dir(
            catalog_id, dataset_id, distribution_id, catalogs_dir,
            use_short_path=True)
        distribution_file_path = os.path.join(
            distribution_dir, distribution_file_name)
    else:
        distribution_dir = get_distribution_dir(
            catalog_id, dataset_id, distribution_id, catalogs_dir,
            use_short_path=False)
        distribution_file_path = os.path.join(
            distribution_dir, "download", distribution_file_name)

    return os.path.abspath(distribution_file_path)
832043
def _get_url_base(self, url):
        
        s = urlsplit(url)
        return urlunsplit([s.scheme, s.netloc, '', '', ''])
579203
def sha1sum_url(url):
    '''

    '''
    import hashlib
    import urllib
    from contextlib import closing

    sha1 = hashlib.sha1()
    chunk_size = sha1.block_size * 8192

    max_file_size = 10 * 1024 * 1024  # 10Mo limit in case of very large file

    total_read = 0
    with closing(urllib.urlopen(url)) as url_obj:
        for chunk in iter(lambda: url_obj.read(chunk_size), b''):
            sha1.update(chunk)
            total_read += chunk_size
            if total_read > max_file_size:
                break

    return sha1.hexdigest()
1135041
def urls(self, key, value):
    
    def _is_preprint(value):
        return value.get('y', '').lower() == 'preprint'

    def _is_fulltext(value):
        return value['u'].endswith('.pdf') and value['u'].startswith('http://cds.cern.ch')

    def _is_local_copy(value):
        return 'local copy' in value.get('y', '')

    def _is_ignored_domain(value):
        ignored_domains = ['http://cdsweb.cern.ch', 'http://cms.cern.ch',
                           'http://cmsdoc.cern.ch', 'http://documents.cern.ch',
                           'http://preprints.cern.ch', 'http://cds.cern.ch',
                           'http://arxiv.org']
        return any(value['u'].startswith(domain) for domain in ignored_domains)

    field_8564 = self.get('8564_', [])
    field_FFT = self.get('FFT__', [])

    if 'u' not in value:
        return field_8564

    url = escape_url(value['u'])

    if _is_fulltext(value) and not _is_preprint(value):
        if _is_local_copy(value):
            description = value.get('y', '').replace('local copy', 'on CERN Document Server')
            field_8564.append({
                'u': url,
                'y': description,
            })
        else:
            _, file_name = os.path.split(urllib.parse.urlparse(value['u']).path)
            _, extension = os.path.splitext(file_name)
            field_FFT.append({
                't': 'CDS',
                'a': url,
                'd': value.get('y', ''),
                'n': file_name,
                'f': extension,
            })
    elif not _is_ignored_domain(value):
        field_8564.append({
            'u': url,
            'y': value.get('y'),
        })

    self['FFT__'] = field_FFT
    return field_8564
860893
def _get_index_urls_locations(self, project_name):
        # type: (str) -> List[str]
        

        def mkurl_pypi_url(url):
            loc = posixpath.join(
                url,
                urllib_parse.quote(canonicalize_name(project_name)))
            # For maximum compatibility with easy_install, ensure the path
            # ends in a trailing slash.  Although this isn't in the spec
            # (and PyPI can handle it without the slash) some other index
            # implementations might break if they relied on easy_install's
            # behavior.
            if not loc.endswith('/'):
                loc = loc + '/'
            return loc

        return [mkurl_pypi_url(url) for url in self.index_urls]
691520
def score_url(self, url):
        
        t = urlparse(url)
        return (t.scheme != 'https', 'pypi.python.org' in t.netloc,
                posixpath.basename(t.path))
104154
public IssuingDistributionPointExtension
        getIssuingDistributionPointExtension() throws IOException {

        Object obj = getExtension(PKIXExtensions.IssuingDistributionPoint_Id);
        return (IssuingDistributionPointExtension) obj;
    }
1292934
def get_url(client, name, version, wheel=False, hashed_format=False):
    
    try:
        release_urls = client.release_urls(name, version)
        release_data = client.release_data(name, version)
    except BaseException:  # some kind of error with client
        logger.debug('Client: {0} Name: {1} Version: {2}.'.format(
            client, name, version))
        raise exceptions.MissingUrlException(
            "Some kind of error while communicating with client: {0}.".format(
                client), exc_info=True)

    url = ''
    md5_digest = None

    if not wheel:
        # Prefered archive is tar.gz
        if len(release_urls):
            zip_url = zip_md5 = ''
            for release_url in release_urls:
                if release_url['url'].endswith("tar.gz"):
                    url = release_url['url']
                    md5_digest = release_url['md5_digest']
                if release_url['url'].endswith(".zip"):
                    zip_url = release_url['url']
                    zip_md5 = release_url['md5_digest']
            if url == '':
                url = zip_url or release_urls[0]['url']
                md5_digest = zip_md5 or release_urls[0]['md5_digest']
        elif release_data:
            url = release_data['download_url']
    else:
        # Only wheel is acceptable
        for release_url in release_urls:
            if release_url['url'].endswith("none-any.whl"):
                url = release_url['url']
                md5_digest = release_url['md5_digest']
                break
    if not url:
        raise exceptions.MissingUrlException(
            "Url of source archive not found.")

    if url == 'UNKNOWN':
        raise exceptions.MissingUrlException(
            "{0} package has no sources on PyPI, Please ask the maintainer "
            "to upload sources.".format(release_data['name']))

    if not hashed_format:
        url = ("https://files.pythonhosted.org/packages/source"
               "/{0[0]}/{0}/{1}").format(name, url.split("/")[-1])

    return (url, md5_digest)
844896
def get_juttle_data_url(deployment_name,
                        token_manager=None,
                        app_url=defaults.APP_URL):
    
    return get_data_url(deployment_name,
                        endpoint_type='juttle',
                        app_url=app_url,
                        token_manager=token_manager)
636771
def getPeer(self, url):
        
        peers = filter(lambda x: x.getUrl() == url, self.getPeers())
        if len(peers) == 0:
            raise exceptions.PeerNotFoundException(url)
        return peers[0]
83823
def delta_crl_distribution_points(self):
        

        if self._delta_crl_distribution_points is None:
            self._delta_crl_distribution_points = self._get_http_crl_distribution_points(self.freshest_crl_value)
        return self._delta_crl_distribution_points
1246056
def get_url_distribution(self, params=None):
        
        params = params or {}
        all_responses = {}
        api_name = 'virustotal-url-distribution'

        response_chunks = self._request_reports(list(params.keys()), list(params.values()), 'url/distribution')
        self._extract_response_chunks(all_responses, response_chunks, api_name)

        return all_responses
1262480
protected static URL getContributorURL(Contributor contributor, Log log) {
		URL url = null;
		if (contributor != null) {
			String rawUrl = contributor.getUrl();
			if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
				try {
					url = new URL(rawUrl);
				} catch (Throwable exception) {
					url = null;
				}
			}
			if (url == null) {
				rawUrl = contributor.getEmail();
				if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
					try {
						url = new URL("mailto:" + rawUrl); //$NON-NLS-1$
					} catch (Throwable exception) {
						url = null;
					}
				}
			}
		}
		return url;
	}
455060
def _get_subject_uri(self, guid=None):
        
        uri = self.uri + '/v1/subject'
        if guid:
            uri += '/' + urllib.quote_plus(guid)
        return uri
1312930
def master_distribution_point(refresh = false)
      @master_distribution_point = nil if refresh
      return @master_distribution_point if @master_distribution_point

      all_dps = JSS::DistributionPoint.all refresh, api: self

      @master_distribution_point =
        case all_dps.size
        when 0
          raise JSS::NoSuchItemError, 'No distribution points defined'
        when 1
          JSS::DistributionPoint.fetch id: all_dps.first[:id], api: self
        else
          JSS::DistributionPoint.fetch id: :master, api: self
        end
    end