Get the URL or sandbox to release.
779538
def get_package(self):
        
        directory = self.directory
        develop = self.develop
        scmtype = self.scmtype

        self.scm = self.scms.get_scm(scmtype, directory)

        if self.scm.is_valid_url(directory):
            directory = self.urlparser.abspath(directory)

            self.remoteurl = directory
            self.isremote = self.push = True
        else:
            directory = abspath(expanduser(directory))
            self.isremote = False

            self.scm.check_valid_sandbox(directory)
            self.setuptools.check_valid_package(directory)

            name, version = self.setuptools.get_package_info(directory, develop)
            print('Releasing', name, version)

            if not self.skipcommit:
                if self.scm.is_dirty_sandbox(directory):
                    self.scm.commit_sandbox(directory, name, version, self.push)
1094203
def get_action(args):
    """"""
    redirect_mode = args.bang or args.search or args.lucky
    if redirect_mode and not args.url:
        return webbrowser.open_new_tab
    else:
        return print_result
575353
def action_add_url(self):
        """"""
        if not self.env.context.get('active_model'):
            return
        attachment_obj = self.env['ir.attachment']
        for form in self:
            url = parse.urlparse(form.url)
            if not url.scheme:
                url = parse.urlparse('%s%s' % ('http://', form.url))
            for active_id in self.env.context.get('active_ids', []):
                attachment = {
                    'name': form.name,
                    'type': 'url',
                    'url': url.geturl(),
                    'res_id': active_id,
                    'res_model': self.env.context['active_model'],
                }
                attachment_obj.create(attachment)
        return {'type': 'ir.actions.act_close_wizard_and_reload_view'}
1323347
def _open_url(url):
    """"""
    response = requests.get(url, stream=True)
    if response.status_code != 200:
        raise IOError("Unable to download {}, HTTP {}".format(url, response.status_code))
    return response
141698
def _get(self, url, params={}):
        """"""
        r = requests.get(self._api_prefix + url,
            params=params,
            headers=self.headers,
            auth=self.auth,
        )
        return self._action(r)
889665
def release(self, login, package_name, version):
        '''
        
        '''
        url = '%s/release/%s/%s/%s' % (self.domain, login, package_name, version)
        res = self.session.get(url)
        self._check_response(res)
        return res.json()
560137
def get_static_url():
    """"""
    path = getattr(settings, 'STATIC_URL', None)
    if not path:
        path = getattr(settings, 'MEDIA_URL', None)
    if not path:
        path = '/'
    return path
25119
def release(self):
        """"""
        success, _ = self.etcd_client.transaction(
            compare=[
                self.etcd_client.transactions.value(self.key) == self.uuid
            ],
            success=[self.etcd_client.transactions.delete(self.key)],
            failure=[]
        )
        return success
786552
def release(self, priority=None, delay=0):
        """"""
        if self.reserved:
            self.conn.release(self.jid, priority or self._priority(), delay)
            self.reserved = False
1026510
def curl(self):
        """"""
        c = self._pycurl
        # Resume download
        if os.path.exists(self.path) and self.resume:
            mode = 'ab'
            self.downloaded = os.path.getsize(self.path)
            c.setopt(pycurl.RESUME_FROM, self.downloaded)
        else:
            mode = 'wb'
        with open(self.path, mode) as f:
            c.setopt(c.URL, utf8_encode(self.url))
            if self.auth:
                c.setopt(c.USERPWD, '%s:%s' % self.auth)
            c.setopt(c.USERAGENT, self._user_agent)
            c.setopt(c.WRITEDATA, f)
            h = self._get_pycurl_headers()
            if h is not None:
                c.setopt(pycurl.HTTPHEADER, h)
            c.setopt(c.NOPROGRESS, 0)
            c.setopt(pycurl.FOLLOWLOCATION, 1)
            c.setopt(c.PROGRESSFUNCTION, self.progress)
            self._fill_in_cainfo()
            if self._pass_through_opts:
                for key, value in self._pass_through_opts.items():
                    c.setopt(key, value)
            c.perform()
99056
def from_url(cls, url, version=None, require_https=False):
        
        if "https://" in url:
            require_https = True
        if "http://" in url and require_https:
            try:
                hive = cls.from_url(url, version=version, require_https=False)
            except HiveLoadedOverHTTP as err:
                hive = err.hive
            raise HiveLoadedOverHTTP(url, hive)
        else:
            try:
                return cls(**download_as_json(url)).from_version(version, require_https)
            except (ResponseException, URLError):
                raise MissingHive(url)
1340238
def _get_banner():
    """"""

    result = ''
    result += '\nPython %s' % _sys.version
    result += '\n\nWbemcli interactive shell'
    result += '\n%s' % _get_connection_info()

    # Give hint about exiting. Most people exit with 'quit()' which will
    # not return from the interact() method, and thus will not write
    # the history.
    if _sys.platform == 'win32':
        result += '\nEnter Ctrl-Z or quit() or exit() to exit'
    else:
        result += '\nPress Ctrl-D or enter quit() or exit() to exit'
    result += '\nEnter h() for help'

    return result
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)
1254078
def execute(self, cacheable=False):
        """"""

        if self.network.is_caching_enabled() and cacheable:
            response = self._get_cached_response()
        else:
            response = self._download_response()

        return minidom.parseString(_string(response).replace("opensearch:", ""))
1235549
def download(self, url, path=None, force=False):
        """"""
        logger.debug(str((url, path, force)))
        method = self._download
        return self._create_worker(method, url, path=path, force=force)
195607
def make_release(self):
        
        directory = self.directory
        infoflags = self.infoflags
        branch = self.branch
        develop = self.develop
        scmtype = self.scm.name

        tempdir = abspath(tempfile.mkdtemp(prefix='mkrelease-'))
        try:
            if self.isremote:
                directory = join(tempdir, 'build')
                self.scm.clone_url(self.remoteurl, directory)
            else:
                directory = abspath(expanduser(directory))

            self.scm.check_valid_sandbox(directory)

            if self.isremote:
                branch = self.scm.make_branchid(directory, branch)
                if branch:
                    self.scm.switch_branch(directory, branch)
                if scmtype != 'svn':
                    branch = self.scm.get_branch_from_sandbox(directory)
                    print('Releasing branch', branch)

            self.setuptools.check_valid_package(directory)

            if not (self.skipcommit and self.skiptag):
                self.scm.check_dirty_sandbox(directory)
                self.scm.check_unclean_sandbox(directory)

            name, version = self.setuptools.get_package_info(directory, develop)
            if self.isremote:
                print('Releasing', name, version)

            if not self.skiptag:
                print('Tagging', name, version)
                tagid = self.scm.make_tagid(directory, version)
                self.scm.check_tag_exists(directory, tagid)
                self.scm.create_tag(directory, tagid, name, version, self.push)

            if self.manifest:
                scmtype = 'none'

            for distcmd, distflags in self.distributions:
                manifest = self.setuptools.run_egg_info(
                    directory, infoflags, scmtype, self.quiet)
                distfile = self.setuptools.run_dist(
                    directory, infoflags, distcmd, distflags, scmtype, self.quiet)

                for location in self.locations:
                    if self.locations.is_server(location):
                        if not self.get_skipregister(location):
                            self.setuptools.run_register(
                                directory, infoflags, location, scmtype, self.quiet)
                        if not self.get_skipupload():
                            uploadflags = self.get_uploadflags(location)
                            if '--sign' in uploadflags and isfile(distfile+'.asc'):
                                os.remove(distfile+'.asc')
                            self.setuptools.run_upload(
                                directory, infoflags, distcmd, distflags, location, uploadflags,
                                scmtype, self.quiet)
                    else:
                        if not self.skipupload:
                            if self.locations.is_ssh_url(location):
                                scheme, location = self.urlparser.to_ssh_url(location)
                                self.scp.run_upload(scheme, distfile, location)
                            else:
                                self.scp.run_upload('scp', distfile, location)
        finally:
            shutil.rmtree(tempdir)
1160462
def download():
    """"""
    # Allow users with access to the build to download the file. Falls back
    # to API keys with access to the build. Prefer user first for speed.
    try:
        build = auth.can_user_access_build('build_id')
    except HTTPException:
        logging.debug('User access to artifact failed. Trying API key.')
        _, build = auth.can_api_key_access_build('build_id')

    sha1sum = request.args.get('sha1sum', type=str)
    if not sha1sum:
        logging.debug('Artifact sha1sum=%r not supplied', sha1sum)
        abort(404)

    artifact = models.Artifact.query.get(sha1sum)
    if not artifact:
        logging.debug('Artifact sha1sum=%r does not exist', sha1sum)
        abort(404)

    build_id = request.args.get('build_id', type=int)
    if not build_id:
        logging.debug('build_id missing for artifact sha1sum=%r', sha1sum)
        abort(404)

    is_owned = artifact.owners.filter_by(id=build_id).first()
    if not is_owned:
        logging.debug('build_id=%r not owner of artifact sha1sum=%r',
                      build_id, sha1sum)
        abort(403)

    # Make sure there are no Set-Cookie headers on the response so this
    # request is cachable by all HTTP frontends.
    @utils.after_this_request
    def no_session(response):
        if 'Set-Cookie' in response.headers:
            del response.headers['Set-Cookie']

    if not utils.is_production():
        # Insert a sleep to emulate how the page loading looks in production.
        time.sleep(1.5)

    if request.if_none_match and request.if_none_match.contains(sha1sum):
        response = flask.Response(status=304)
        return response

    return _get_artifact_response(artifact)