Construct a transformation object
2600
def get_transformation(self, coordinates):
        """"""
        atom1, atom2, atom3 = self.hinge_atoms
        center = coordinates[atom2]
        a = coordinates[atom1] - coordinates[atom2]
        b = coordinates[atom3] - coordinates[atom2]
        axis = np.cross(a, b)
        norm = np.linalg.norm(axis)
        if norm < 1e-5:
            # We suppose that atom3 is part of the affected atoms
            axis = random_orthonormal(a)
        else:
            axis /= np.linalg.norm(axis)
        angle = np.random.uniform(-self.max_amplitude, self.max_amplitude)
        return Complete.about_axis(center, angle, axis)
1123148
function prepareTransforms (entityTransforms, namespace, target) {
  const resolvedNamespace = namespace || ''
  const resolvedTarget = target || {}
  for (const d in entityTransforms) {
    if (typeof (entityTransforms[d]) === 'function') {
      resolvedTarget[resolvedNamespace + d] = entityTransforms[d]
      resolvedTarget[d] = entityTransforms[d]
    } else {
      prepareTransforms(entityTransforms[d], resolvedNamespace + d + '.', resolvedTarget)
    }
  }

  return resolvedTarget
}
1107750
@JRubyMethod
    public static IRubyObject transform(IRubyObject self) {
        //             System.err.println("()");
        Ruby runtime = self.getRuntime();
        ThreadContext ctx = runtime.getCurrentContext();
        org.yecht.Node orig_n = (org.yecht.Node)self.dataGetStructChecked();
        YAMLExtra x = ((Node)self).x;
        IRubyObject t = new Node(runtime, self.getType(), null, x);
        org.yecht.Node n = null;

        switch(orig_n.kind) {
        case Map:
            n = org.yecht.Node.allocMap();
            t.dataWrapStruct(n);
            org.yecht.Data.Map dm = (org.yecht.Data.Map)orig_n.data;
            for(int i=0; i < dm.idx; i++) {
                IRubyObject k = ((IRubyObject)orig_n.mapRead(MapPart.Key, i)).callMethod(ctx, "transform");
                IRubyObject v = ((IRubyObject)orig_n.mapRead(MapPart.Value, i)).callMethod(ctx, "transform");
                n.mapAdd(k, v);
            }
            break;
        case Seq:
            n = org.yecht.Node.allocSeq();
            t.dataWrapStruct(n);
            org.yecht.Data.Seq ds = (org.yecht.Data.Seq)orig_n.data;
            for(int i=0; i < ds.idx; i++) {
                IRubyObject itm = ((IRubyObject)orig_n.seqRead(i)).callMethod(ctx, "transform");
                n.seqAdd(itm);
            }
            break;
        case Str:
            org.yecht.Data.Str dss = (org.yecht.Data.Str)orig_n.data;
            n = org.yecht.Node.newStr(dss.ptr, dss.len, dss.style);
            t.dataWrapStruct(n);
            break;
        }

        if(orig_n.type_id != null) {
            n.type_id = orig_n.type_id;
        }

        if(orig_n.anchor != null) {
            n.anchor = orig_n.anchor;
        }

        n.id = t;
        //             System.err.println("(), setting id of object on: " + n);
        IRubyObject result = x.DefaultResolver.callMethod(ctx, "node_import", t);
        return result;
    }
235008
def transforms(self) -> Mapping[Type, Iterable[Type]]:
        """"""
        try:
            return getattr(self.__class__, "transform")._transforms
        except AttributeError:
            return {}
1051267
function transform ( p, fn ) {
				return function () {
					var result = p();

					return result === null ? null : fn( result );
				};
			}
621599
private <IN1, IN2, OUT> Collection<Integer> transformTwoInputTransform(TwoInputTransformation<IN1, IN2, OUT> transform) {

		Collection<Integer> inputIds1 = transform(transform.getInput1());
		Collection<Integer> inputIds2 = transform(transform.getInput2());

		// the recursive call might have already transformed this
		if (alreadyTransformed.containsKey(transform)) {
			return alreadyTransformed.get(transform);
		}

		List<Integer> allInputIds = new ArrayList<>();
		allInputIds.addAll(inputIds1);
		allInputIds.addAll(inputIds2);

		String slotSharingGroup = determineSlotSharingGroup(transform.getSlotSharingGroup(), allInputIds);

		streamGraph.addCoOperator(
				transform.getId(),
				slotSharingGroup,
				transform.getCoLocationGroupKey(),
				transform.getOperator(),
				transform.getInputType1(),
				transform.getInputType2(),
				transform.getOutputType(),
				transform.getName());

		if (transform.getStateKeySelector1() != null || transform.getStateKeySelector2() != null) {
			TypeSerializer<?> keySerializer = transform.getStateKeyType().createSerializer(env.getConfig());
			streamGraph.setTwoInputStateKey(transform.getId(), transform.getStateKeySelector1(), transform.getStateKeySelector2(), keySerializer);
		}

		streamGraph.setParallelism(transform.getId(), transform.getParallelism());
		streamGraph.setMaxParallelism(transform.getId(), transform.getMaxParallelism());

		for (Integer inputId: inputIds1) {
			streamGraph.addEdge(inputId,
					transform.getId(),
					1
			);
		}

		for (Integer inputId: inputIds2) {
			streamGraph.addEdge(inputId,
					transform.getId(),
					2
			);
		}

		return Collections.singleton(transform.getId());
	}
1305272
def create_transform(ctx, transform):
    """"""
    from canari.commands.create_transform import create_transform
    create_transform(ctx.project, transform)
467662
function classTransformReviver(key, value) {
    if (value && typeof value === 'object' && value.___class && classMappings[value.___class]) {
      value = Object.assign(new classMappings[value.___class](), value)
    }

    return value
  }
664933
def transform_from_rot_trans(R, t):
    """"""
    R = R.reshape(3, 3)
    t = t.reshape(3, 1)
    return np.vstack((np.hstack([R, t]), [0, 0, 0, 1]))
618833
public Object transform( int from, int to, Object input ) {
        return transform( from, to, input, null );
    }
662776
function transform(m) {
         var points = this.points;
         var len = points.length;

         for (var i = 0; i < len; i++) {
           m.multiplyVector(points[i]);
         }

         this.recalc();
         this.updateBounds();
         return this;
       }
394733
def copy(self):
        
        return RigidTransform(np.copy(self.rotation), np.copy(self.translation), self.from_frame, self.to_frame)
122047
def _transform(self, data, transform, step_size):
    '''
    
    '''
    if transform=='mean':
      total = sum( k*v for k,v in data.items() )
      count = sum( data.values() )
      data = float(total)/float(count) if count>0 else 0
    elif transform=='count':
      data = sum(data.values())
    elif transform=='min':
      data = min(data.keys() or [0])
    elif transform=='max':
      data = max(data.keys() or [0])
    elif transform=='sum':
      data = sum( k*v for k,v in data.items() )
    elif transform=='rate':
      data = { k:v/float(step_size) for k,v in data.items() }
    elif callable(transform):
      data = transform(data, step_size)
    return data
1171680
def get_transform(bounds, size=4096):
    
    tx, ty = bounds[0], bounds[1]
    sx, sy = (bounds[2] - bounds[0]) / size, (bounds[3] - bounds[1]) / size

    def forward(lon, lat):
        """ Transform a longitude and latitude to TopoJSON integer space.
        """
        return int(round((lon - tx) / sx)), int(round((lat - ty) / sy))

    return dict(translate=(tx, ty), scale=(sx, sy)), forward
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);
         }
       }
13762
def transform_data(self, data, request=None, response=None, context=None):
        transform = self.transform
        if hasattr(transform, 'context'):
            self.transform.context = context
        """"""
        if transform and not (isinstance(transform, type) and isinstance(data, transform)):
            if self._params_for_transform:
                return transform(data, **self._arguments(self._params_for_transform, request, response))
            else:
                return transform(data)
        return data
1004600
def do_transform(self):
        """"""
        if not self.transform:
            return
        try:
            self.latest_value = utils.Transform(
                expr=self.transform, value=self.latest_value,
                timedelta=self.time_between_updates().total_seconds()).result()
        except (TypeError, ValueError):
            logger.warn("Invalid transformation '%s' for metric %s",
                        self.transfrom, self.pk)
        self.transform = ''