Construct a transformation object
161453
def get_transformation(self, coordinates):
        """"""
        atom1, atom2, atom3, atom4 = self.hinge_atoms
        a = coordinates[atom1] - coordinates[atom2]
        a /= np.linalg.norm(a)
        b = coordinates[atom3] - coordinates[atom4]
        b /= np.linalg.norm(b)
        direction = 0.5*(a+b)
        direction *= np.random.uniform(-self.max_amplitude, self.max_amplitude)
        result = Translation(direction)
        return result
751427
function(d, cx, cy) {
    return this.transform({ rotation: d, cx: cx, cy: cy })
  }
1182448
function chainTransform (obj, path = []) {
  return flatmap(Object.keys(obj), function (key) {
    if (key === 'required') {
      // starts array with `true` or `false` and makes the
      // deepest-nested expression first in the array
      return [path.concat(obj[key]).reverse()];
    } else {
      return chainTransform(obj[key], path.concat(key));
    }
  });
}
618833
public Object transform( int from, int to, Object input ) {
        return transform( from, to, input, null );
    }
278685
function transformStyle(object) {
  if ((0, _has2.default)(object, 'style')) {
    object.style = (0, _transform2.default)((0, _split2.default)(object.style, ';'), (result, style) => {
      const firstColon = style.indexOf(':'),
            key = (0, _trim2.default)(style.substr(0, firstColon));

      if (key) {
        result[toJSXKey((0, _toLower2.default)(key))] = (0, _trim2.default)(style.substr(firstColon + 1));
      }
    }, {});
  }
}
1111053
function _transform() {
	var codeIn = $('#codeIn').val();
	try {
		var codeOut = Streamline.transform(codeIn, {
			runtime: _generators ? "generators" : "callbacks",
		});
		$('#codeOut').val(codeOut);
		info("ready");
	} catch (ex) {
		console.error(ex);
		error(ex.message);
	}
}
116258
public static <T1, T2> T2 transform(T1 object,
            TypeReference<T2> typeReference) {
        try {
            return jsonMapper.convertValue(object, typeReference);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "transform", object);
        }
    }
48334
function createTransform() {
         if (this.currentTransform === null) {
           this.currentTransform = new me.Matrix2d();
         } else {
           // reset the matrix
           this.currentTransform.identity();
         }

         if (this.flippedAD) {
           // Use shearing to swap the X/Y axis
           this.currentTransform.setTransform(0, 1, 0, 1, 0, 0, 0, 0, 1);
           this.currentTransform.translate(0, this.height - this.width);
         }

         if (this.flippedX) {
           this.currentTransform.translate(this.flippedAD ? 0 : this.width, this.flippedAD ? this.height : 0);
           this.currentTransform.scaleX(-1);
         }

         if (this.flippedY) {
           this.currentTransform.translate(this.flippedAD ? this.width : 0, this.flippedAD ? 0 : this.height);
           this.currentTransform.scaleY(-1);
         }
       }
201968
function transform() {
    for (var _len = arguments.length, matrices = Array(_len), _key = 0; _key < _len; _key++) {
        matrices[_key] = arguments[_key];
    }

    matrices = Array.isArray(matrices[0]) ? matrices[0] : matrices;

    var multiply = function multiply(m1, m2) {
        return {
            a: m1.a * m2.a + m1.c * m2.b, c: m1.a * m2.c + m1.c * m2.d, e: m1.a * m2.e + m1.c * m2.f + m1.e,
            b: m1.b * m2.a + m1.d * m2.b, d: m1.b * m2.c + m1.d * m2.d, f: m1.b * m2.e + m1.d * m2.f + m1.f
        };
    };

    switch (matrices.length) {
        case 0:
            throw new Error('no matrices provided');

        case 1:
            return matrices[0];

        case 2:
            return multiply(matrices[0], matrices[1]);

        default:
            var _matrices = matrices,
                _matrices2 = _toArray(_matrices),
                m1 = _matrices2[0],
                m2 = _matrices2[1],
                rest = _matrices2.slice(2);

            var m = multiply(m1, m2);
            return transform.apply(undefined, [m].concat(_toConsumableArray(rest)));
    }
}
247469
def build_transform(self):
        
        cfg = self.cfg

        # we are loading images with OpenCV, so we don't need to convert them
        # to BGR, they are already! So all we need to do is to normalize
        # by 255 if we want to convert to BGR255 format, or flip the channels
        # if we want it to be in RGB in [0-1] range.
        if cfg.INPUT.TO_BGR255:
            to_bgr_transform = T.Lambda(lambda x: x * 255)
        else:
            to_bgr_transform = T.Lambda(lambda x: x[[2, 1, 0]])

        normalize_transform = T.Normalize(
            mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD
        )

        transform = T.Compose(
            [
                T.ToPILImage(),
                T.Resize(self.min_image_size),
                T.ToTensor(),
                to_bgr_transform,
                normalize_transform,
            ]
        )
        return transform
455807
function transform(req, res, next) {
    const state = res.state;
    const body = state.body;
    const type = typeof body;
    const isBuffer = body instanceof Buffer;
    let contentType;

    // error conversion
    if (body instanceof Error) {
        res.log('transform', 'Converting Error to response');
        res.status(500).body(httpStatus[500]).set('content-type', 'text/plain');

    // buffer conversion
    } else if (isBuffer) {
        res.log('transform', 'Converting Buffer to base64 string');
        res.body(body.toString('base64'));
        contentType = 'application/octet-stream';

    // object conversion
    } else if (type === 'object') {
        res.log('transform', 'Converting object to JSON string');
        res.body(JSON.stringify(body));
        contentType = 'application/json';

    // not string conversion
    } else if (type !== 'string') {
        res.log('transform', 'Converting ' + type + ' to string');
        res.body(String(body));
        contentType = 'text/plain';

    } else {
        contentType = 'text/html';
    }

    // set content type if not yet set
    if (!state.headers.hasOwnProperty('content-type') && contentType) {
        res.log('transform', 'Set content type');
        res.set('Content-Type', contentType);
    }

    next();
}
1105520
function transformModel (options, data) {
  const prop = (options.model && options.model.prop) || 'value';
  const event = (options.model && options.model.event) || 'input'
  ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  const on = data.on || (data.on = {});
  const existing = on[event];
  const callback = data.model.callback;
  if (isDef(existing)) {
    if (
      Array.isArray(existing)
        ? existing.indexOf(callback) === -1
        : existing !== callback
    ) {
      on[event] = [callback].concat(existing);
    }
  } else {
    on[event] = callback;
  }
}
552357
function transform( node ) {
	var out;
	out = {
		'name': node.name,
		'description': node.description || '',
		'extends': node.augments || [],
		'fires': node.fires || '',
		'constructor': {
			'name': node.name,
			'description': node.description
		},
		'access': node.access || '',
		'virtual': !!node.virtual
	};
	if ( node.examples ) {
		out.constructor.examples = transformExamples( node.examples );
	} else {
		out.constructor.examples = [];
	}
	if ( node.params ) {
		out.constructor.parameters = transformParams( node.params );
	} else {
		out.constructor.parameters = [];
	}
	return out;
}
880411
function transformer(data) {
        var newData = {};
        var keys = Object.keys(data), length = keys.length, key, i;
        for ( i = 0; i < length; i++) {
          key = keys[i];
          newData[key] = data[key];
        }
        return newData;
      }
462281
def reproject(self, projection):
        
        srs_out = crsConvert(projection, 'osr')
        
        if self.srs.IsSame(srs_out) == 0:
            
            # create the CoordinateTransformation
            coordTrans = osr.CoordinateTransformation(self.srs, srs_out)
            
            layername = self.layername
            geomType = self.geomType
            features = self.getfeatures()
            feat_def = features[0].GetDefnRef()
            fields = [feat_def.GetFieldDefn(x) for x in range(0, feat_def.GetFieldCount())]
            
            self.__init__()
            self.addlayer(layername, srs_out, geomType)
            self.layer.CreateFields(fields)
            
            for feature in features:
                geom = feature.GetGeometryRef()
                geom.Transform(coordTrans)
                newfeature = feature.Clone()
                newfeature.SetGeometry(geom)
                self.layer.CreateFeature(newfeature)
                newfeature = None
            self.init_features()
747909
@Override
    public Object transform( Object input ) {

        Map<String,Object> output = new HashMap<>();

        // Create a root LiteralPathElement so that # is useful at the root level
        MatchedElement rootLpe = new MatchedElement( ROOT_KEY );
        WalkedPath walkedPath = new WalkedPath();
        walkedPath.add( input, rootLpe );

        rootSpec.apply( ROOT_KEY, Optional.of( input ), walkedPath, output, null );

        return output.get( ROOT_KEY );
    }
517569
def get_transformation(self, coordinates):
        """"""
        atom1, atom2 = self.hinge_atoms
        direction = coordinates[atom1] - coordinates[atom2]
        direction /= np.linalg.norm(direction)
        direction *= np.random.uniform(-self.max_amplitude, self.max_amplitude)
        result = Translation(direction)
        return result