Attempts to upload a given Docker image from this server to DockerHub.

        Parameters:
            name: the name of the Docker image.

        Returns:
            `True` if successfully uploaded, otherwise `False`.
972922
def upload(self, name: str) -> bool:
        
        try:
            out = self.__docker.images.push(name, stream=True)
            for line in out:
                line = line.strip().decode('utf-8')
                jsn = json.loads(line)
                if 'progress' in jsn:
                    line = "{}. {}.".format(jsn['status'], jsn['progress'])
                    print(line, end='\r')
                elif 'status' in jsn:
                    print(jsn['status'])
            print('uploaded image to DockerHub: {}'.format(name))
            return True
        except docker.errors.NotFound:
            print("Failed to push image ({}): not installed.".format(name))
            return False
1213776
def get_image_upload_to(self, filename):
        
        dummy, ext = os.path.splitext(filename)
        return os.path.join(
            machina_settings.FORUM_IMAGE_UPLOAD_TO,
            '{id}{ext}'.format(id=str(uuid.uuid4()).replace('-', ''), ext=ext),
        )
313981
def build(self, tag, **kwargs):
        
        self.push_log("Building image '{0}'.".format(tag))
        set_raise_on_error(kwargs)
        try:
            return super(DockerFabricClient, self).build(tag, **kwargs)
        except DockerStatusError as e:
            error(e.message)
162590
def _getCacheEntry(self, name):
        
        return next((x for x in self._uploadCache if x['name'] == name), None)
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)
768371
def upload(self, bug: Bug) -> bool:
        
        return self.__installation.build.upload(bug.image)
550169
def import_image(self, name, tags=None):
        
        stream_import_file = os.path.join(self.os_conf.get_build_json_store(),
                                          'image_stream_import.json')
        with open(stream_import_file) as f:
            stream_import = json.load(f)
        return self.os.import_image(name, stream_import, tags=tags)
159822
def image_delete(self, image_name):
        
        try:
            self._imageops.image_delete(image_name)
        except exception.SDKBaseException:
            LOG.error("Failed to delete image '%s'" % image_name)
            raise
311035
def upload_file(self, file_name, file_obj, *args, **kwargs):
		
		self.ftp_client().storbinary('STOR ' + file_name, file_obj)
666116
def upload(self, release, filename, content_type=None):
        
        release = self.as_id(release)
        name = os.path.basename(filename)
        if not content_type:
            content_type, _ = mimetypes.guess_type(name)
        if not content_type:
            raise ValueError('content_type not known')
        inputs = {'name': name}
        url = '%s%s/%s/assets' % (self.uploads_url,
                                  urlsplit(self.api_url).path,
                                  release)
        info = os.stat(filename)
        size = info[stat.ST_SIZE]
        response = self.http.post(
            url, data=stream_upload(filename), auth=self.auth,
            params=inputs,
            headers={'content-type': content_type,
                     'content-length': str(size)})
        response.raise_for_status()
        return response.json()
1184197
public void canUpload(String name, long fileSize) {
        URL url = UPLOAD_FILE_URL.build(this.getAPI().getBaseURL());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");

        JsonObject parent = new JsonObject();
        parent.add("id", this.getID());

        JsonObject preflightInfo = new JsonObject();
        preflightInfo.add("parent", parent);
        preflightInfo.add("name", name);

        preflightInfo.add("size", fileSize);

        request.setBody(preflightInfo.toString());
        BoxAPIResponse response = request.send();
        response.disconnect();
    }
1090386
def remove_container(name, force=False):
    

    try:
        if not force:
            _get_docker().stop(name)
    except APIError:
        pass
    try:
        _get_docker().remove_container(name, force=True)
        return True
    except APIError:
        return False
1154855
def file_upload_to(self, instance, filename):
        
        ext = filename.split(".")[-1]
        filename = "{}.{}".format(uuid.uuid4(), ext)
        return os.path.join("document", filename)
44
def upload(self, tool: Tool) -> bool:
        
        return self.__installation.build.upload(tool.image)
64476
def delete_image(self, name: str) -> None:
        
        logger.debug("deleting Docker image: %s", name)
        path = "docker/images/{}".format(name)
        response = self.__api.delete(path)
        if response.status_code != 204:
            try:
                self.__api.handle_erroneous_response(response)
            except Exception:
                logger.exception("failed to delete Docker image: %s", name)
                raise
        else:
            logger.info("deleted Docker image: %s", name)
227914
def update_image_2(self, container_name, image_name):
        
        code, container = self.get_container(container_name)
        if code == httplib.NOT_FOUND:
            raise ContainerNotFound(container_name)
        elif code != httplib.OK:
            raise GeneralError(code)

        _, old_image_name, _ = utils.parse_image_name(container.image)
        repository, name, version = utils.parse_image_name(image_name)
        if not repository or repository.lower() != DOCKER_NEG:
            image_name = '{0}/{1}:{2}'.format(DOCKER_NEG, name, version)

        if not repo.image_exists(name, tag=version):
            raise ImageNotFound("{0} do not location in docker.neg repository.".format(image_name))

        if old_image_name.lower() != name.lower():
            raise ImageConflict("{0} is not be same with container's Image.".format(image_name))

        code, result = self.pull_image(name, version)
        if code != httplib.OK:
            raise GeneralError(
                'pull image {0}:{1} failure, status code {2}, result: {3}'.format(name, version, code, result))

        code, result = self.update(container_name, tag=version)
        if code != httplib.OK:
            raise GeneralError(
                'Update container {0} failure, status code {1}, result: {2}'.format(container_name, code, result))

        return True
1061836
def create(self, name, **kwds):
        
        result = self._client.post("/album/create.json",
                                   name=name, **kwds)["result"]
        return Album(self._client, result)