Complain if we don't have an image
508135
def find_image(self, image, configuration):
        """"""
        images = configuration["images"]
        available = list(images.keys())

        if not image:
            info = {}
            if available:
                info["available"] = available
            raise BadOption("Please use --image to specify an image", **info)

        if image not in images:
            raise BadOption("No such image", wanted=image, available=available)
924645
def get_image(self, id):
        """"""
        url = self._base_url + "/3/image/{0}".format(id)
        resp = self._send_request(url)
        return Image(resp, self)
227745
def object_image
      image = object_data[:image] if object_available?

      return image.file.url if image.respond_to?(:file)
      return image if image.present?

      fallback_image
    end
1358284
def before_all(ctx):
    

    ctx.client = get_client()
    try:
        ctx.client.inspect_image(IMAGE)
    except NotFound:
        ctx.client.pull(IMAGE)
33295
def image_get(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.get_image(**kwargs)
994433
def is_image(name, exts=None):
    """"""

    default = ['jpg', 'png', 'gif', 'jpeg']
    if exts:
        default += exts

    flag = False
    for ext in default:
        if name.lower().endswith(ext):
            flag = True
            break
    return flag
1076204
def __get_image(conn, vm_):
    '''
    
    '''
    img = config.get_cloud_config_value(
        'image', vm_, __opts__, default='debian-7', search_global=False)
    return conn.ex_get_image(img)
578928
def new(self, size, fill):
        """"""
        return Image(PIL.Image.new("RGB", size, fill))
629292
def image_search(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.search_images(**kwargs)
504010
def set_image(self):
        """"""

        if not self.image:
            scrape_image(self)

        # If still no image then use first contributor image
        if not self.image:
            contributors = self.get_primary_contributors()
            if contributors:
                self.image = contributors[0].image
                self.save(set_image=False)

        # If still not image then default
        if not self.image:
            filename = settings.STATIC_ROOT + 'music/images/default.png'
            if os.path.exists(filename):
                image = File(
                    open(filename, 'rb')
                )
                image.name = 'default.png'
                self.image = image
                self.save(set_image=False)
467632
def image(request, obj_id):
    """"""
    obj = Image.objects.get(pk=obj_id)
    if request.method == 'POST':
        return post(request, obj)
    elif request.method == 'PUT':
        getPutData(request)
        return put(request, obj)
    elif request.method == 'DELETE':
        getPutData(request)
        return delete(request, obj)
388680
def get_exception_based_on_api_message(message, image_name=""):
    """"""
    msg_bigger_than_source = re.compile('Image was not scaled, is the requested width bigger than the source?')
    msg_does_not_exist = re.compile('The source file .* does not exist')
    msg_does_not_exist_bis = re.compile('<div class="error"><p>Value not found')
    if re.search(msg_bigger_than_source, message):
        msg = "File %s requested at a width bigger than source" % image_name
        return RequestedWidthBiggerThanSourceException(msg)
    elif re.search(msg_does_not_exist, message):
        msg = "File %s does not exist" % image_name
        return FileDoesNotExistException(msg)
    elif re.search(msg_does_not_exist_bis, message):
        msg = "File %s does not exist" % image_name
        return FileDoesNotExistException(msg)
    else:
        return DownloadException(message)
104585
def image(version = nil)
      image = provide_attr(:image)

      return image.file.url(version) if image.respond_to?(:file)
      return image if image.present?

      fallback_image
    end
1364068
def _get_image_or_404(identifier, load_image=False):
    
    try:
        image_id = int(identifier)
    except ValueError:
        raise Http404()

    ik_image = get_object_or_404(ICEkitImage, id=image_id)
    if not load_image:
        return ik_image, None

    ####################################################################
    # Image-loading incantation cribbed from easythumbnail's `pil_image`
    image = Image.open(BytesIO(ik_image.image.read()))
    # Fully load the image now to catch any problems with the image contents.
    try:
        # An "Image file truncated" exception can occur for some images that
        # are still mostly valid -- we'll swallow the exception.
        image.load()
    except IOError:
        pass
    # Try a second time to catch any other potential exceptions.
    image.load()
    if True:  # Support EXIF orientation data
        image = et_utils.exif_orientation(image)
    ####################################################################

    return ik_image, image
1374302
protected void handleFeedImages(List<Pair<String, CharSequence>> params,
                                  Collection<IFeedImage> images) {
    if (images != null && images.size() > 4) {
      throw new IllegalArgumentException("At most four images are allowed, got " +
                                         Integer.toString(images.size()));
    }
    if (null != images && !images.isEmpty()) {
      int image_count = 0;
      for (IFeedImage image : images) {
        ++image_count;
        String imageUrl = image.getImageUrlString(); 
        assert null != imageUrl && "".equals(imageUrl) : "Image URL must be provided";
        params.add(new Pair<String, CharSequence>(String.format("image_%d", image_count),
                                                  image.getImageUrlString()));
        assert null != image.getLinkUrl() : "Image link URL must be provided";
        params.add(new Pair<String, CharSequence>(String.format("image_%d_link", image_count),
                                                  image.getLinkUrl().toString()));
      }
    }
  }
1158314
def image_show(self, image_id):
        '''
        
        '''
        nt_ks = self.compute_conn
        image = nt_ks.images.get(image_id)
        links = {}
        for link in image.links:
            links[link['rel']] = link['href']
        ret = {
            'name': image.name,
            'id': image.id,
            'status': image.status,
            'progress': image.progress,
            'created': image.created,
            'updated': image.updated,
            'metadata': image.metadata,
            'links': links,
        }
        if hasattr(image, 'minDisk'):
            ret['minDisk'] = image.minDisk
        if hasattr(image, 'minRam'):
            ret['minRam'] = image.minRam

        return ret
892124
def has_custom_image(user_context, app_id):
  """"""
  possible_paths = _valid_custom_image_paths(user_context, app_id)
  return any(map(os.path.exists, possible_paths))