Attempts to upload the Docker image for a given bug to
        `DockerHub <https://hub.docker.com>`_.
768371
def upload(self, bug: Bug) -> bool:
        
        return self.__installation.build.upload(bug.image)
520582
def push_image(self, image, insecure=False):
        
        logger.info("pushing image '%s'", image)
        logger.debug("image: '%s', insecure: '%s'", image, insecure)
        try:
            # push returns string composed of newline separated jsons; exactly what 'docker push'
            # outputs
            command_result = self.retry_generator(self.d.push,
                                                  image.to_str(tag=False),
                                                  tag=image.tag, insecure_registry=insecure,
                                                  decode=True, stream=True)
        except TypeError:
            # because changing api is fun
            command_result = self.retry_generator(self.d.push,
                                                  image.to_str(tag=False),
                                                  tag=image.tag, decode=True, stream=True)

        self.last_logs = command_result.logs
        return command_result.parsed_logs
856160
def uploadStickerFile(self, user_id, png_sticker):
        
        p = _strip(locals(), more=['png_sticker'])
        return self._api_request_with_file('uploadStickerFile', _rectify(p), 'png_sticker', png_sticker)
68354
def tag_image(self, repository=None, tag=None):
        
        if not (repository or tag):
            raise ValueError("You need to specify either repository or tag.")
        r = repository or self.name
        t = "latest" if not tag else tag
        self.d.tag(image=self.get_full_name(), repository=r, tag=t)
        return DockerImage(r, tag=t)
1348106
def _resolve_image(ret, image, client_timeout):
    '''
    
    '''
    image_id = __salt__['docker.resolve_image_id'](image)

    if image_id is False:
        if not __opts__['test']:
            # Image not pulled locally, so try pulling it
            try:
                pull_result = __salt__['docker.pull'](
                    image,
                    client_timeout=client_timeout,
                )
            except Exception as exc:
                raise CommandExecutionError(
                    'Failed to pull {0}: {1}'.format(image, exc)
                )
            else:
                ret['changes']['image'] = pull_result
                # Try resolving again now that we've pulled
                image_id = __salt__['docker.resolve_image_id'](image)
                if image_id is False:
                    # Shouldn't happen unless the pull failed
                    raise CommandExecutionError(
                        'Image \'{0}\' not present despite a docker pull '
                        'raising no errors'.format(image)
                    )
    return image_id
311830
def import_image(self, image=None, tag='latest', **kwargs):
        
        self.push_log("Fetching image '{0}' from registry.".format(image))
        return super(DockerFabricClient, self).import_image(image=image, tag=tag, **kwargs)
723488
def create(output_dir):
    """"""
    template_path = os.path.join(os.path.dirname(__file__), 'project_template')

    click.secho('Let\'s create a new component!', fg='green')
    name = click.prompt('What is the name of this component (ex. python-pip)?')

    click.secho('')
    click.secho('We assume this will be pushed to GitHub and Docker Hub eventually, but these don\'t have to exist yet.', fg='green')
    repo_owner = click.prompt('GitHub repo owner (i.e. your username or organization name)')
    repo_name = click.prompt('GitHub repo name', default=name)
    dockerhub_owner = click.prompt('Docker Hub repo owner', default=repo_owner)
    dockerhub_name = click.prompt('Docker Hub repo name', default=repo_name)

    license_owner = click.prompt('Who should be the copyright owner on project?', default=repo_owner)

    extra_context = {
        'name': name,
        'name_shields_io': name.replace('-', '--'),
        'current_year': datetime.datetime.now().year,
        'dependencies_cli_version': __version__,
        'repo_owner': repo_owner,
        'repo_name': repo_name,
        'dockerhub_owner': dockerhub_owner,
        'dockerhub_name': dockerhub_name,
        'license_owner': license_owner,
    }
    project_dir = cookiecutter(template_path, no_input=True, extra_context=extra_context, output_dir=output_dir)

    click.secho('')
    click.secho('{name} is ready to go, `cd {project_dir}` and try running `dependencies test`!'.format(name=name, project_dir=project_dir), fg='green')
    click.secho(
        'We started you out with a fully functioning component based in python.\n' +
        'Once you\'ve got a handle on how it works then you can change it to whatever language you want.'
    )
489310
def bug(self, container: Container) -> Bug:
        
        name = container.bug
        return self.__installation.bugs[name]
1220754
def remove_image(self, image, **kwargs):
        
        self.push_log("Removing image '{0}'.".format(image))
        set_raise_on_error(kwargs)
        super(DockerFabricClient, self).remove_image(image, **kwargs)
1078583
def import_image(self, name, stream_import, tags=None):
        

        # Get the JSON for the ImageStream
        imagestream_json = self.get_image_stream(name).json()
        logger.debug("imagestream: %r", imagestream_json)

        if 'dockerImageRepository' in imagestream_json.get('spec', {}):
            logger.debug("Removing 'dockerImageRepository' from ImageStream %s", name)
            source_repo = imagestream_json['spec'].pop('dockerImageRepository')
            imagestream_json['metadata']['annotations'][ANNOTATION_SOURCE_REPO] = source_repo
            imagestream_json = self.update_image_stream(name, imagestream_json).json()

        # Note the tags before import
        oldtags = imagestream_json.get('status', {}).get('tags', [])
        logger.debug("tags before import: %r", oldtags)

        stream_import['metadata']['name'] = name
        stream_import['spec']['images'] = []
        tags_set = set(tags) if tags else set()
        for tag in imagestream_json.get('spec', {}).get('tags', []):
            if tags_set and tag['name'] not in tags_set:
                continue

            image_import = {
                'from': tag['from'],
                'to': {'name': tag['name']},
                'importPolicy': tag.get('importPolicy'),
                'referencePolicy': tag.get('referencePolicy'),
            }
            stream_import['spec']['images'].append(image_import)

        if not stream_import['spec']['images']:
            logger.debug('No tags to import')
            return False

        import_url = self._build_url("imagestreamimports/")
        import_response = self._post(import_url, data=json.dumps(stream_import),
                                     use_json=True)
        self._check_import_image_response(import_response)

        new_tags = [
            image['tag']
            for image in import_response.json().get('status', {}).get('images', [])]
        logger.debug("tags after import: %r", new_tags)

        return True
615507
def build(client, repository_tag, docker_file, tag=None, use_cache=False):
        
        if not isinstance(client, docker.Client):
            raise TypeError("client needs to be of type docker.Client.")

        if not isinstance(docker_file, six.string_types) or not os.path.exists(docker_file):
            # TODO: need to add path stuff for git and http etc.
            raise Exception("docker file path doesn't exist: {0}".format(docker_file))

        if not isinstance(repository_tag, six.string_types):
            raise TypeError('repository must be a string')

        if not tag:
            tag = 'latest'

        if not isinstance(use_cache, bool):
            raise TypeError("use_cache must be a bool. {0} was passed.".format(use_cache))

        no_cache = not use_cache

        if ':' not in repository_tag:
            repository_tag = "{0}:{1}".format(repository_tag, tag)
        file_obj = None
        try:
            if os.path.isfile(docker_file):
                path = os.getcwd()
                docker_file = "./{0}".format(os.path.relpath(docker_file))

                # TODO: support using file_obj in the future. Needed for post pre hooks and the injector.
                # with open(docker_file) as Dockerfile:
                #     testing = Dockerfile.read()
                #     file_obj = BytesIO(testing.encode('utf-8'))

                response = client.build(
                    path=path,
                    nocache=no_cache,
                    # custom_context=True,
                    dockerfile=docker_file,
                    # fileobj=file_obj,
                    tag=repository_tag,
                    rm=True,
                    stream=True
                )
            else:
                response = client.build(path=docker_file, tag=repository_tag, rm=True, nocache=no_cache, stream=True)
        except Exception as e:
            raise e
        finally:
            if file_obj:
                file_obj.close()

        parse_stream(response)
        client.close()

        return Image(client, repository_tag)
1373831
function pullImage(docker, image, options) {
  return new Promise(function(accept, reject) {
    docker.pull(image).then(function(stream) {
      var pullStatusStream = new PullStatusStream();
      stream.pipe(pullStatusStream);

      pullStatusStream.on('data', function(value) {
        debug('pull image', value.toString());
      });

      pullStatusStream.once('error', reject);
      pullStatusStream.once('end', accept);
    });
  });
}
324680
def upload_debug(self):
        """"""
        if os.path.exists(self.log_fname):
            api = InternalApi()
            api.set_current_run_id(self.id)
            pusher = FilePusher(api)
            pusher.update_file("wandb-debug.log", self.log_fname)
            pusher.file_changed("wandb-debug.log", self.log_fname)
            pusher.finish()
1049738
def as_issue(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.issue_url
        )
        return github.Issue.Issue(self._requester, headers, data, completed=True)
1129657
def upload(self):
        '''
        
        '''
        if not self.exists():
            self.create()

        data = self.stage().json()
        self.file_upload(data['post_url'], data)
        res = self.commit(data['dist_id'])
        data = res.json()
        return data
186987
def upload_large_icon(app_version, upload_image)
      raise "app_version is required" unless app_version
      raise "upload_image is required" unless upload_image

      du_client.upload_large_icon(app_version, upload_image, content_provider_id, sso_token_for_image)
    end
1316216
def build_image_from_inherited_image(self, image_name: str, image_tag: str,
                                         repo_path: Path,
                                         requirements_option: RequirementsOptions):
        

        base_name, base_tag = self.get_inherit_image()

        if requirements_option == RequirementsOptions.no_requirements:
            image = self.get_image(base_name, base_tag)
            image.tag(image_name, image_tag)  # so ``build_image`` doesn't have to be called next time

            return image

        dockerfile = self.get_install_requirements_dockerfile(base_name, base_tag, repo_path, requirements_option)

        self.get_or_build_image(image_name, image_tag, dockerfile, build_context=repo_path.parent, pull=False)

        return self.get_image(image_name, image_tag)