Method to directly apply the corrections.
762995
def apply_corrections(self):
        
        for error in self.errors:
            for solution in error.scheduler_adapter_solutions:
                if self.scheduler_adapter is not None:
                    if self.scheduler_adapter.__getattribut__(solution[0].__name__)(solution[1]):
                        return True
            for solution in error.application_adapter_solutions:
                if self.application_adapter is not None:
                    if self.application_adapter.__getattribut__(solution[0].__name__)(solution[1]):
                        return True
        return False
1080397
function correctionFactor() {
    var args = Array.prototype.slice.call(arguments);
    return args.reduce(function (prev, next) {
      var mp = multiplier(prev),
        mn = multiplier(next);
      return mp > mn ? mp : mn;
    }, -Infinity);
  }
750207
def apply(self, styler):
        """"""
        return styler.format(self.formatter, *self.args, **self.kwargs)
71251
public void apply() {
		// see if the distortion class needs to be created again
		if( distorter == null ) {
			Class typeOut = output.getImageType().getImageClass();
			switch( input.getImageType().getFamily() ) {
				case GRAY:
					distorter = FactoryDistort.distortSB(cached, (InterpolatePixelS)interp, typeOut);
					break;

				case PLANAR:
					distorter = FactoryDistort.distortPL(cached, (InterpolatePixelS)interp, typeOut);
					break;

				case INTERLEAVED:
					distorter = FactoryDistort.distortIL(cached, (InterpolatePixelMB) interp, output.getImageType());
					break;

				default:
					throw new IllegalArgumentException("Unsupported image type");
			}
		}
		distorter.setModel(outputToInput);

		distorter.apply(input,output);
	}
482710
def set_corrected_pval(self, nt_method, pvalue):
        """"""
        self.method_flds.append(nt_method)
        fieldname = "".join(["p_", nt_method.fieldname])
        setattr(self, fieldname, pvalue)
114201
public void applyExtrusions() {
        for( int i = 0; i < dwgObjects.size(); i++ ) {
            DwgObject dwgObject = (DwgObject) dwgObjects.get(i);
            if (dwgObject instanceof DwgArc) {
                double[] arcCenter = ((DwgArc) dwgObject).getCenter();
                double[] arcExt = ((DwgArc) dwgObject).getExtrusion();
                arcCenter = AcadExtrusionCalculator.CalculateAcadExtrusion(arcCenter, arcExt);
                ((DwgArc) dwgObject).setCenter(arcCenter);
            } else if (dwgObject instanceof DwgAttdef) {
                // Extrusion in DwgAttdef is not necessary
            } else if (dwgObject instanceof DwgAttrib) {
                Point2D attribInsertionPoint = ((DwgAttrib) dwgObject).getInsertionPoint();
                double attribElevation = ((DwgAttrib) dwgObject).getElevation();
                double[] attribInsertionPoint3D = new double[]{attribInsertionPoint.getX(),
                        attribInsertionPoint.getY(), attribElevation};
                double[] attribExt = ((DwgAttrib) dwgObject).getExtrusion();
                attribInsertionPoint3D = AcadExtrusionCalculator.CalculateAcadExtrusion(
                        attribInsertionPoint3D, attribExt);
                ((DwgAttrib) dwgObject).setInsertionPoint(new Point2D.Double(
                        attribInsertionPoint3D[0], attribInsertionPoint3D[1]));
                ((DwgAttrib) dwgObject).setElevation(attribInsertionPoint3D[2]);
            } else if (dwgObject instanceof DwgBlock) {
                // DwgBlock hasn't Extrusion
            } else if (dwgObject instanceof DwgBlockControl) {
                // DwgBlockControl hasn't Extrusion
            } else if (dwgObject instanceof DwgBlockHeader) {
                // DwgBlockHeader hasn't Extrusion
            } else if (dwgObject instanceof DwgCircle) {
                double[] circleCenter = ((DwgCircle) dwgObject).getCenter();
                double[] circleExt = ((DwgCircle) dwgObject).getExtrusion();
                circleCenter = AcadExtrusionCalculator.CalculateAcadExtrusion(circleCenter,
                        circleExt);
                ((DwgCircle) dwgObject).setCenter(circleCenter);
                // Seems that Autocad don't apply the extrusion to Ellipses
                /*} else if (dwgObject instanceof DwgEllipse) {
                 double[] ellipseCenter = ((DwgEllipse)dwgObject).getCenter();
                 double[] ellipseExt = ((DwgEllipse)dwgObject).getExtrusion();
                 ellipseCenter = AcadExtrusionCalculator.CalculateAcadExtrusion(ellipseCenter, ellipseExt);
                 ((DwgEllipse)dwgObject).setCenter(ellipseCenter);*/
            } else if (dwgObject instanceof DwgInsert) {
                double[] insertPoint = ((DwgInsert) dwgObject).getInsertionPoint();
                double[] insertExt = ((DwgInsert) dwgObject).getExtrusion();
                insertPoint = AcadExtrusionCalculator
                        .CalculateAcadExtrusion(insertPoint, insertExt);
                ((DwgInsert) dwgObject).setInsertionPoint(insertPoint);
            } else if (dwgObject instanceof DwgLayer) {
                // DwgLayer hasn't Extrusion
            } else if (dwgObject instanceof DwgLayerControl) {
                // DwgLayerControl hasn't Extrusion
            } else if (dwgObject instanceof DwgLine) {
                double[] lineP1 = ((DwgLine) dwgObject).getP1();
                double[] lineP2 = ((DwgLine) dwgObject).getP2();
                boolean zflag = ((DwgLine) dwgObject).isZflag();
                if (zflag) {
                    // elev = 0.0;
                    lineP1 = new double[]{lineP1[0], lineP1[1], 0.0};
                    lineP2 = new double[]{lineP2[0], lineP2[1], 0.0};
                }
                double[] lineExt = ((DwgLine) dwgObject).getExtrusion();
                lineP1 = AcadExtrusionCalculator.CalculateAcadExtrusion(lineP1, lineExt);
                lineP2 = AcadExtrusionCalculator.CalculateAcadExtrusion(lineP2, lineExt);
                ((DwgLine) dwgObject).setP1(lineP1);
                ((DwgLine) dwgObject).setP2(lineP2);
            } else if (dwgObject instanceof DwgLinearDimension) {
                // TODO: Extrusions in DwgLinearDimension elements
                // TODO: Void LwPolylines are a bug
            } else if (dwgObject instanceof DwgLwPolyline
                    && ((DwgLwPolyline) dwgObject).getVertices() != null) {
                Point2D[] vertices = ((DwgLwPolyline) dwgObject).getVertices();
                double[] lwPolylineExt = ((DwgLwPolyline) dwgObject).getNormal();
                // Normals and Extrusions aren`t the same
                if (lwPolylineExt[0] == 0 && lwPolylineExt[1] == 0 && lwPolylineExt[2] == 0)
                    lwPolylineExt[2] = 1.0;
                double elev = ((DwgLwPolyline) dwgObject).getElevation();
                double[][] lwPolylinePoints3D = new double[vertices.length][3];
                for( int j = 0; j < vertices.length; j++ ) {
                    lwPolylinePoints3D[j][0] = vertices[j].getX();
                    lwPolylinePoints3D[j][1] = vertices[j].getY();
                    lwPolylinePoints3D[j][2] = elev;
                    lwPolylinePoints3D[j] = AcadExtrusionCalculator.CalculateAcadExtrusion(
                            lwPolylinePoints3D[j], lwPolylineExt);
                }
                ((DwgLwPolyline) dwgObject).setElevation(elev);
                for( int j = 0; j < vertices.length; j++ ) {
                    vertices[j] = new Point2D.Double(lwPolylinePoints3D[j][0],
                            lwPolylinePoints3D[j][1]);
                }
                ((DwgLwPolyline) dwgObject).setVertices(vertices);
            } else if (dwgObject instanceof DwgMText) {
                double[] mtextPoint = ((DwgMText) dwgObject).getInsertionPoint();
                double[] mtextExt = ((DwgMText) dwgObject).getExtrusion();
                mtextPoint = AcadExtrusionCalculator.CalculateAcadExtrusion(mtextPoint, mtextExt);
                ((DwgMText) dwgObject).setInsertionPoint(mtextPoint);
            } else if (dwgObject instanceof DwgPoint) {
                double[] point = ((DwgPoint) dwgObject).getPoint();
                double[] pointExt = ((DwgPoint) dwgObject).getExtrusion();
                point = AcadExtrusionCalculator.CalculateAcadExtrusion(point, pointExt);
                ((DwgPoint) dwgObject).setPoint(point);
            } else if (dwgObject instanceof DwgSolid) {
                double[] corner1 = ((DwgSolid) dwgObject).getCorner1();
                double[] corner2 = ((DwgSolid) dwgObject).getCorner2();
                double[] corner3 = ((DwgSolid) dwgObject).getCorner3();
                double[] corner4 = ((DwgSolid) dwgObject).getCorner4();
                double[] solidExt = ((DwgSolid) dwgObject).getExtrusion();
                corner1 = AcadExtrusionCalculator.CalculateAcadExtrusion(corner1, solidExt);
                ((DwgSolid) dwgObject).setCorner1(corner1);
                ((DwgSolid) dwgObject).setCorner2(corner2);
                ((DwgSolid) dwgObject).setCorner3(corner3);
                ((DwgSolid) dwgObject).setCorner4(corner4);
            } else if (dwgObject instanceof DwgSpline) {
                // DwgSpline hasn't Extrusion
            } else if (dwgObject instanceof DwgText) {
                Point2D tpoint = ((DwgText) dwgObject).getInsertionPoint();
                double elev = ((DwgText) dwgObject).getElevation();
                double[] textPoint = new double[]{tpoint.getX(), tpoint.getY(), elev};
                double[] textExt = ((DwgText) dwgObject).getExtrusion();
                textPoint = AcadExtrusionCalculator.CalculateAcadExtrusion(textPoint, textExt);
                ((DwgText) dwgObject).setInsertionPoint(new Point2D.Double(textPoint[0],
                        textPoint[1]));
                ((DwgText) dwgObject).setElevation(elev);
            } else if (dwgObject instanceof DwgPolyline2D
                    && ((DwgPolyline2D) dwgObject).getPts() != null) {
                Point2D[] vertices = ((DwgPolyline2D) dwgObject).getPts();
                double[] polyline2DExt = ((DwgPolyline2D) dwgObject).getExtrusion();
                double elev = ((DwgPolyline2D) dwgObject).getElevation();
                double[][] polylinePoints3D = new double[vertices.length][3];
                for( int j = 0; j < vertices.length; j++ ) {
                    polylinePoints3D[j][0] = vertices[j].getX();
                    polylinePoints3D[j][1] = vertices[j].getY();
                    polylinePoints3D[j][2] = elev;
                    polylinePoints3D[j] = AcadExtrusionCalculator.CalculateAcadExtrusion(
                            polylinePoints3D[j], polyline2DExt);
                }
                ((DwgPolyline2D) dwgObject).setElevation(elev);
                for( int j = 0; j < vertices.length; j++ ) {
                    vertices[j] = new Point2D.Double(polylinePoints3D[j][0], polylinePoints3D[j][1]);
                }
                ((DwgPolyline2D) dwgObject).setPts(vertices);
            } else if (dwgObject instanceof DwgPolyline3D) {
                // DwgPolyline3D hasn't Extrusion
            } else if (dwgObject instanceof DwgVertex2D) {
                // DwgVertex2D hasn't Extrusion
            } else if (dwgObject instanceof DwgVertex3D) {
                // DwgVertex3D hasn't Extrusion
            } else {
                //
            }
        }
    }
272478
def apply_global_fixes(source, options, where='global', filename=''):
    
    if any(code_match(code, select=options.select, ignore=options.ignore)
           for code in ['E101', 'E111']):
        source = reindent(source,
                          indent_size=options.indent_size)

    for (code, function) in global_fixes():
        if code_match(code, select=options.select, ignore=options.ignore):
            if options.verbose:
                print('--->  Applying {0} fix for {1}'.format(where,
                                                              code.upper()),
                      file=sys.stderr)
            source = function(source,
                              aggressive=options.aggressive)

    source = fix_2to3(source,
                      aggressive=options.aggressive,
                      select=options.select,
                      ignore=options.ignore,
                      filename=filename)

    return source
974009
public void applyTranQ( DMatrixRMaj A ) {
        for( int j = 0; j < minLength; j++ ) {
            int diagIndex = j*numRows+j;
            double before = QR.data[diagIndex];
            QR.data[diagIndex] = 1;
            QrHelperFunctions_DDRM.rank1UpdateMultR(A, QR.data, j * numRows, gammas[j], 0, j, numRows, v);
            QR.data[diagIndex] = before;
        }
    }
1072774
public void apply()
    {
        String in = readLineWithMessage("Edit Product with id:");
        int id = Integer.parseInt(in);

        // We don't have a reference to the selected Product.
        // So first we have to lookup the object,
        // we do this by a query by example (QBE):
        // 1. build an example object with matching primary key values:
        Product example = new Product();
        example.setId(id);

        // 2. build a QueryByIdentity from this sample instance:
        Query query = new QueryByIdentity(example);
        try
        {
            // 3. start broker transaction
            broker.beginTransaction();

            // 4. lookup the product specified by the QBE
            Product toBeEdited = (Product) broker.getObjectByQuery(query);

            // 5. edit the existing entry
            System.out.println("please edit the product entry");
            in = readLineWithMessage("enter name (was " + toBeEdited.getName() + "):");
            toBeEdited.setName(in);
            in = readLineWithMessage("enter price (was " + toBeEdited.getPrice() + "):");
            toBeEdited.setPrice(Double.parseDouble(in));
            in = readLineWithMessage("enter available stock (was " + toBeEdited.getStock() + "):");
            toBeEdited.setStock(Integer.parseInt(in));



            // 6. now ask broker to store the edited object
            broker.store(toBeEdited);
            // 7. commit transaction
            broker.commitTransaction();
        }
        catch (Throwable t)
        {
            // rollback in case of errors
            broker.abortTransaction();
            t.printStackTrace();
        }
    }
645864
def apply(self, collection, ops, **kwargs):
        """"""
        validator = lambda obj: all(op(obj, val) for (op, val) in ops)  # noqa
        return [o for o in collection if validator(o)]
1123225
def write_corrected(self, output, clobber=False):
        """"""

        # un-apply the flatfield if necessary
        if self.flatcorr != 'COMPLETE':
            self.science = self.science / self.invflat
            self.err = self.err / self.invflat

        # un-apply the post-flash if necessary
        if self.flshcorr != 'COMPLETE':
            self.science = self.science + self.flash

        # un-apply the dark if necessary
        if self.darkcorr != 'COMPLETE':
            self.science = self.science + self.dark

        # reverse the amp merge
        if (self.ampstring == 'ABCD'):
            tmp_1, tmp_2 = np.split(self.science, 2, axis=1)
            self.hdulist['sci', 1].data = tmp_1.copy()
            self.hdulist['sci', 2].data = tmp_2[::-1, :].copy()

            tmp_1, tmp_2 = np.split(self.err, 2, axis=1)
            self.hdulist['err', 1].data = tmp_1.copy()
            self.hdulist['err', 2].data = tmp_2[::-1, :].copy()
        else:
            self.hdulist['sci', 1].data = self.science.copy()
            self.hdulist['err', 1].data = self.err.copy()

        # Write the output
        self.hdulist.writeto(output, overwrite=clobber)
1267906
def apply_refactor(self, call_id, payload):
        """"""
        supported_refactorings = ["Rename", "InlineLocal", "AddImport", "OrganizeImports"]

        if payload["refactorType"]["typehint"] in supported_refactorings:
            diff_filepath = payload["diff"]
            path = self.editor.path()
            bname = os.path.basename(path)
            target = os.path.join(self.tmp_diff_folder, bname)
            reject_arg = "--reject-file={}.rej".format(target)
            backup_pref = "--prefix={}".format(self.tmp_diff_folder)
            # Patch utility is prepackaged or installed with vim
            cmd = ["patch", reject_arg, backup_pref, path, diff_filepath]
            failed = Popen(cmd, stdout=PIPE, stderr=PIPE).wait()
            if failed:
                self.editor.message("failed_refactoring")
            # Update file and reload highlighting
            self.editor.edit(self.editor.path())
            self.editor.doautocmd('BufReadPre', 'BufRead', 'BufEnter')
726010
def _apply_aeff_corrections(intensity_map, aeff_corrections):
        
        data = aeff_corrections * intensity_map.data.T
        return HpxMap(data.T, intensity_map.hpx)
993369
private static void adjustCalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight,
										 FMatrixRMaj rectifyK,
										 RectangleLength2D_F32 bound, float scale) {
		// translation
		float deltaX = -bound.x0*scale;
		float deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
		SimpleMatrix K = SimpleMatrix.wrap(rectifyK);

		// remove previous calibration matrix
		SimpleMatrix K_inv = K.invert();
		rL = K_inv.mult(rL);
		rR = K_inv.mult(rR);

		// compute new calibration matrix and apply it
		K = A.mult(K);

		rectifyK.set(K.getFDRM());
		rectifyLeft.set(K.mult(rL).getFDRM());
		rectifyRight.set(K.mult(rR).getFDRM());
	}
1179790
private double adjustBetaSign( double beta , List<Point3D_F64> nullPts ) {
		if( beta == 0 )
			return 0;

		int N = alphas.numRows;

		int positiveCount = 0;

		for( int i = 0; i < N; i++ ) {
			double z = 0;
			for( int j = 0; j < numControl; j++ ) {
				Point3D_F64 c = nullPts.get(j);
				z += alphas.get(i,j)*c.z;
			}

			if( z > 0 )
				positiveCount++;
		}

		if( positiveCount < N/2 )
			beta *= -1;

		return beta;
	}
701588
void internalAddContractions(int c, UnicodeSet set) {
        new ContractionsAndExpansions(set, null, null, false).forCodePoint(data, c);
    }
55759
protected function recalculateTotal(): void
    {
        $this->total = $this->itemsTotal + $this->adjustmentsTotal;

        if ($this->total < 0) {
            $this->total = 0;
        }
    }