Lazy instantiation of the list of transformations used during the image download. This method
returns a List<Transformation> because Picasso doesn't support a null instance as
transformation.
481911
private List<Transformation> getTransformations() {
    if (transformations == null) {
      transformations = new LinkedList<Transformation>();
      if (useCircularTransformation) {
        transformations.add(new CircleTransformation());
      }
    }
    return transformations;
  }
172252
def transformation(func):
    """"""
    @wraps(func)
    def func_as_transformation(*args, **kwargs):
        
        # When using transforms that return new ndarrays we lose the
        # jicimagelib.image.Image type and the history of the image.
        # One therefore needs to:
        #  - Extract the history from the input jicimagelib.image.Image.
        #  - Apply the transformation, which may return a numpy ndarray.
        #  - Force the image to the jicimagelib.image.Image type.
        #  - Re-attach the extracted history
        if hasattr(args[0], 'history'):
            # Working on jicimagelib.Image.
            history = args[0].history
        else:
            # Working on something without a history, e.g. a ndarray stack.
            history = []
        image = func(*args, **kwargs)
        image = Image.from_array(image, log_in_history=False)
        image.history = history

        image.history.append('Applied {} transform'.format(func.__name__))
        if AutoWrite.on:
            fpath = AutoName.name(func)
            try:
                if AutoWrite.auto_safe_dtype:
                    safe_range_im = 255 * normalise(image)
                    pil_im = PIL.Image.fromarray(safe_range_im.astype(np.uint8))
                else:
                    pil_im = PIL.Image.fromarray(image)
            except TypeError:
                # Give a more meaningful error message.
                raise(TypeError(
                    "Cannot handle this data type: {}".format(image.dtype)))
            pil_im.save(fpath)
        return image
    return func_as_transformation
767541
private <T> Collection<Integer> transformUnion(UnionTransformation<T> union) {
		List<StreamTransformation<T>> inputs = union.getInputs();
		List<Integer> resultIds = new ArrayList<>();

		for (StreamTransformation<T> input: inputs) {
			resultIds.addAll(transform(input));
		}

		return resultIds;
	}
42613
@Override
    protected ImageWritable doTransform(ImageWritable image, Random random) {
        if (shuffle) {
            Collections.shuffle(imageTransforms);
        }

        currentTransforms.clear();

        // execute each item in the pipeline
        for (Pair<ImageTransform, Double> tuple : imageTransforms) {
            if (tuple.getSecond() == 1.0 || rng.nextDouble() < tuple.getSecond()) { // probability of execution
                currentTransforms.add(tuple.getFirst());
                image = random != null ? tuple.getFirst().transform(image, random)
                        : tuple.getFirst().transform(image);
            }
        }

        return image;
    }
216918
public static sdxtools_image[] get(nitro_service client) throws Exception
	{
		sdxtools_image resource = new sdxtools_image();
		resource.validate("get");
		return (sdxtools_image[]) resource.get_resources(client);
	}
251772
private void initializeDraggablePanel() {
    draggablePanel.setFragmentManager(getSupportFragmentManager());
    draggablePanel.setTopFragment(youtubeFragment);
    MoviePosterFragment moviePosterFragment = new MoviePosterFragment();
    moviePosterFragment.setPoster(VIDEO_POSTER_THUMBNAIL);
    moviePosterFragment.setPosterTitle(VIDEO_POSTER_TITLE);
    draggablePanel.setBottomFragment(moviePosterFragment);
    draggablePanel.initializeView();
    Picasso.with(this)
        .load(SECOND_VIDEO_POSTER_THUMBNAIL)
        .placeholder(R.drawable.xmen_placeholder)
        .into(thumbnailImageView);
  }
1275133
private Drawable getDrawable(Uri uri) {
        try {
            String scheme = uri.getScheme();
            if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
                // Load drawables through Resources, to get the source density information
                try {
                    return getDrawableFromResourceUri(uri);
                } catch (Resources.NotFoundException ex) {
                    throw new FileNotFoundException("Resource does not exist: " + uri);
                }
            } else {
                // Let the ContentResolver handle content and file URIs.
                InputStream stream = mProviderContext.getContentResolver().openInputStream(uri);
                if (stream == null) {
                    throw new FileNotFoundException("Failed to open " + uri);
                }
                try {
                    return Drawable.createFromStream(stream, null);
                } finally {
                    try {
                        stream.close();
                    } catch (IOException ex) {
                        Log.e(LOG_TAG, "Error closing icon stream for " + uri, ex);
                    }
                }
            }
        } catch (FileNotFoundException fnfe) {
            Log.w(LOG_TAG, "Icon not found: " + uri + ", " + fnfe.getMessage());
            return null;
        }
    }
139233
public static List<TransformationDescription> getDescriptionsFromXMLInputStream(InputStream fileContent) {
        List<TransformationDescription> desc = new ArrayList<TransformationDescription>();
        try {
            desc = loadDescrtipionsFromXMLInputSource(new InputSource(fileContent), null);
        } catch (Exception e) {
            LOGGER.error("Unable to read the descriptions from input stream. ", e);
        }
        return desc;
    }
1109408
public Feature transform(Source input) throws TransformationException {
        if (input == null) {
            return null;
        } else {
            EntityClassReader reader = EntityClassReader.getClassReaderFor(input.getClass());
            try {
                return reader.asFeature(input);
            } catch (InvalidObjectReaderException e) {
                // Can't happen!
                throw new TransformationException("Transformation failed", e);
            }
        }
    }
250760
public Drawable get() {
        final Drawable[] drawables = new Drawable[]{
                mPlaceHolder,
                new BitmapDrawable(mContext.getResources(), Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888)),
        };

        final TransitionDrawable transitionDrawable = new TransitionDrawable(drawables);
        into(new Callback() {
            @Override
            public void onBitmapLoaded(String path, Bitmap bitmap) {
                Log.d(TAG, "callback " + path + " called");
                if (bitmap != null) {
                    Log.d(TAG, "bitmap " + path + " loaded");

                    Drawable drawable = drawables[1];
                    if (drawable != null && drawable instanceof BitmapDrawable) {
                        BitmapDrawable bitmapDrawable = (BitmapDrawable) drawables[1];

                        try {
                            Method method = BitmapDrawable.class.getDeclaredMethod("setBitmap", Bitmap.class);
                            method.setAccessible(true);
                            method.invoke(bitmapDrawable, bitmap);

                            Log.d(TAG, "bitmap " + path + " added to transition");

                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }

                    transitionDrawable.startTransition(500);
                    Log.d(TAG, "image " + path + " transition started");
                }

            }
        });

        return transitionDrawable;
    }
661912
def transformations(self, type=None, failed=False):
        
        if failed not in ["all", False, True]:
            raise ValueError("{} is not a valid transmission failed".format(failed))

        if type is None:
            type = Transformation

        if failed == "all":
            return type.query.filter_by(node_id=self.id).all()
        else:
            return type.query.filter_by(node_id=self.id, failed=failed).all()
205977
public AffineTransform getTransform() {
        if (FloatingPointUtil.equals(this.rotation, 0.0)) {
            return null;
        }

        final Dimension rotatedMapSize = getRotatedMapSize();

        final AffineTransform transform = AffineTransform.getTranslateInstance(0.0, 0.0);
        // move to the center of the original map rectangle (this is the actual
        // size of the graphic)
        transform.translate(this.mapSize.width / 2, this.mapSize.height / 2);

        // then rotate around this center
        transform.rotate(this.rotation);

        // then move to an artificial origin (0,0) which might be outside of the actual
        // painting area. this origin still keeps the center of the original map area
        // at the center of the rotated map area.
        transform.translate(-rotatedMapSize.width / 2, -rotatedMapSize.height / 2);

        return transform;
    }
1373990
@Override
    public void loadFullScreenImage(final ImageView iv, String imageUrl, int width, final LinearLayout bgLinearLayout) {
        if (!TextUtils.isEmpty(imageUrl)) {
            Picasso.with(iv.getContext())
                    .load(imageUrl)
                    .resize(width, 0)
                    .into(iv, new Callback() {
                        @Override
                        public void onSuccess() {
                            Bitmap bitmap = ((BitmapDrawable) iv.getDrawable()).getBitmap();
                            Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
                                public void onGenerated(Palette palette) {
                                    applyPalette(palette, bgLinearLayout);
                                }
                            });
                        }

                        @Override
                        public void onError() {

                        }
                    });
        } else {
            iv.setImageDrawable(null);
        }
    }
1042917
@Override
    public List<Metric> transform(QueryContext queryContext, List<Metric>... listOfList) {
        List<Metric> result = new ArrayList<>();

        for (List<Metric> list : listOfList) {
            for (Metric metric : list) {
                result.add(metric);
            }
        }
        return result;
    }
1305337
public Mirage getMirage (ImageKey key, Rectangle bounds, Colorization[] zations)
    {
        BufferedImage src = null;
        if (bounds == null) {
            // if they specified no bounds, we need to load up the raw image and determine its
            // bounds so that we can pass those along to the created mirage
            src = getImage(key, zations);
            bounds = new Rectangle(0, 0, src.getWidth(), src.getHeight());
        }
        return new CachedVolatileMirage(this, key, bounds, zations);

    }
523414
private void initializeFragments() {
    placeFragment = new PlaceFragment();
    mapFragment = SupportMapFragment.newInstance(
        new GoogleMapOptions().mapType(GoogleMap.MAP_TYPE_SATELLITE));
    Picasso.with(this)
        .load("http://www.hdiphonewallpapers.us/phone-wallpapers/iphone-4-wallpapers/"
            + "hd-iphone-3gs-wallpapers-496ios.jpg")
        .into(drawerImageView);
  }
660301
@Override
    public void loadImageThumbnail(final ImageView iv, String imageUrl, int dimension) {
        if (!TextUtils.isEmpty(imageUrl)) {
            Picasso.with(iv.getContext())
                    .load(imageUrl)
                    .resize(dimension, dimension)
                    .centerCrop()
                    .into(iv);
        } else {
            iv.setImageDrawable(null);
        }
    }