Performs standard opertions
553270
def _did_perform_standard_operation(self, connection):
        

        if connection.async:
            callback = connection.callbacks['remote']

            if connection.user_info and 'nurest_object' in connection.user_info:
                callback(connection.user_info['nurest_object'], connection)
            else:
                callback(self, connection)
        else:
            if connection.response.status_code >= 400 and BambouConfig._should_raise_bambou_http_error:
                raise BambouHTTPError(connection=connection)

            # Case with multiple objects like assignment
            if connection.user_info and 'nurest_objects' in connection.user_info:

                if connection.user_info['commit']:
                    for nurest_object in connection.user_info['nurest_objects']:
                        self.add_child(nurest_object)
                return (connection.user_info['nurest_objects'], connection)

            if connection.user_info and 'nurest_object' in connection.user_info:

                if connection.user_info['commit']:
                    self.add_child(connection.user_info['nurest_object'])

                return (connection.user_info['nurest_object'], connection)

            return (self, connection)
450137
private void performDynamicStep() {
        // initially look for singular values of zero
        if( findingZeros ) {
            if( steps > 6 ) {
                findingZeros = false;
            } else {
                double scale = computeBulgeScale();
                performImplicitSingleStep(scale,0,false);
            }
        } else {
            // For very large and very small numbers the only way to prevent overflow/underflow
            // is to have a common scale between the wilkinson shift and the implicit single step
            // What happens if you don't is that when the wilkinson shift returns the value it
            // computed it multiplies it by the scale twice, which will cause an overflow
            double scale = computeBulgeScale();
            // use the wilkinson shift to perform a step
            double lambda = selectWilkinsonShift(scale);

            performImplicitSingleStep(scale,lambda,false);
        }
    }
758757
def is_seventyfive_moves(self) -> bool:
        
        if self.halfmove_clock >= 150:
            if any(self.generate_legal_moves()):
                return True

        return False
398473
private void perform(int operation, int position, long bs, int length) {
		checkBitsLength(length);
		position = adjPosition(position);
		checkMutable();
		performAdj(operation, position, bs, length);
	}
479181
def free_shake(self, x):
        '''
        '''
        self.lock[:] = False
        normals, values, error = self._compute_equations(x)[:-1]
        counter = 0
        while True:
            if error <= self.threshold:
                break
            # try a well-behaved move to the constrains
            result = self._fast_shake(x, normals, values, error)
            counter += 1
            if result is not None:
                x, normals, values, error = result
            else:
                # well-behaved move is too slow.
                # do a cumbersome move to satisfy constraints approximately.
                x, normals, values, error = self._rough_shake(x, normals, values, error)
                counter += 1
            # When too many iterations are required, just give up.
            if counter > self.max_iter:
                raise ConstraintError('Exceeded maximum number of shake iterations.')
        return x, counter, len(values)
1157124
def _render_dynamic(self, dynamic_exercise, min_rep,
                        desired_reps, desired_intensity, validate):
        

        # --------------------------------
        # Generate possible repstring and calculate penalties
        # --------------------------------
        repstrings = []
        for k in range(self.TIMES_TO_RENDER):

            # If going to minimum, add the minimum repetition to the reps
            if self.go_to_min:
                reps = generate_reps(min_rep,
                                     dynamic_exercise.max_reps,
                                     desired_reps - min_rep,
                                     [min_rep])
            else:
                reps = generate_reps(min_rep,
                                     dynamic_exercise.max_reps,
                                     desired_reps)

            # Calculate the penalty
            intensities = list(map(self.reps_to_intensity_func, reps))

            pargs = reps, intensities, desired_reps, desired_intensity, min_rep
            penalty_value = self.repstring_penalty(*pargs)

            repstrings.append((penalty_value, reps, intensities))

        # --------------------------------
        # Find the best generated repstring and verify it
        # --------------------------------
        best_repstring = min(repstrings)
        (penalty_value, reps, intensities) = best_repstring

        # Perform a sanity check:
        # If repetitions are too high, a low average intensity cannot be attained
        if desired_intensity > self.reps_to_intensity_func(min_rep) and validate:
            msg = """
WARNING: The exercise '{}' is restricted to repetitions in the range [{}, {}],
but the desired average intensity for this week is {}. Reaching this intensity
is not attainable since it corresponds to repetitions lower than {}.
SOLUTION: Either (1) allow lower repetitions, (2) change the desired intensity
or (3) ignore this message. The software will do it's best to remedy this.
""".format(dynamic_exercise.name, dynamic_exercise.max_reps, min_rep,
           desired_intensity, min_rep)
            warnings.warn(msg)

        # Perform a sanity check:
        # If repetitions are too low, a high average intensity cannot be attained
        if desired_intensity < self.reps_to_intensity_func(
                dynamic_exercise.max_reps) and validate:
            msg = """
WARNING: The exercise '{}' is restricted to repetitions in the range [{}, {}],
but the desired average intensity for this week is {}. Reaching this intensity
is not attainable since it corresponds to repetitions higher than {}.
SOLUTION: Either (1) allow higher repetitions, (2) change the desired intensity
or (3) ignore this message. The software will do it's best to remedy this.
""".format(dynamic_exercise.name, dynamic_exercise.max_reps, min_rep,
           desired_intensity, dynamic_exercise.max_reps)
            warnings.warn(msg)

        return {'reps': reps, 'intensities': intensities}
1162010
def emulate_abs(self, x_val, y_val, timeval):
        """"""
        x_event = self.create_event_object(
            "Absolute",
            0x00,
            x_val,
            timeval)
        y_event = self.create_event_object(
            "Absolute",
            0x01,
            y_val,
            timeval)
        return x_event, y_event
104413
def unit_normal(pt_a, pt_b, pt_c):
    """"""
    x_val = np.linalg.det([[1, pt_a[1], pt_a[2]], [1, pt_b[1], pt_b[2]], [1, pt_c[1], pt_c[2]]])
    y_val = np.linalg.det([[pt_a[0], 1, pt_a[2]], [pt_b[0], 1, pt_b[2]], [pt_c[0], 1, pt_c[2]]])
    z_val = np.linalg.det([[pt_a[0], pt_a[1], 1], [pt_b[0], pt_b[1], 1], [pt_c[0], pt_c[1], 1]])
    magnitude = (x_val**2 + y_val**2 + z_val**2)**.5
    mag = (x_val/magnitude, y_val/magnitude, z_val/magnitude)
    if magnitude < 0.00000001:
        mag = (0, 0, 0)
    return mag
100530
def com(points, masses=None):
    """"""
    if masses is None:
        return np.average(points, axis=0)
    else:
        return np.average(points, axis=0, weights=masses)
236106
def steps(self, start, end):
        
        if not 0 <= start <= 1:
            raise ValueError('Values must be between 0 and 1.')
        if not 0 <= end <= 1:
            raise ValueError('Values must be between 0 and 1.')

        raw_start = self._to_single_raw_pwm(start)
        raw_end = self._to_single_raw_pwm(end)
        return abs(raw_start - raw_end)
1231492
def run
      results = { }
      keyboards.each do |keyboard|
        # set up container vars
        prev_hand = nil
        alternation_effort = 0
        reach_effort = 0
        open_and_process(filename,'r') do |file|
          while line = file.gets
            line.each_char do |char|
              if effort = keyboard::MAP[char]

                # measure alternation efficiency
                hand = keyboard::LEFT_KEYS.include?(char) ? 'l' : 'r'
                if prev_hand
                  alternation_effort += (hand == prev_hand) ? 1 : 0
                end
                prev_hand = hand

                # measure reach efficiency
                reach_effort += effort
              end

            end
          end
        end

        results[keyboard::NAME.to_sym] = {
          :alternation_effort => alternation_effort,
          :reach_effort => reach_effort,
          :raw_score => (alternation_effort + reach_effort)
        }
      end
      results
    end
704228
function bench(functions, options) {
  const funcs = assertFunctions(functions);
  const opts = assertOptions(options);
  const metrics = [];
  const totalRuns = funcs.length * opts.runs;
  let runCount = 0;

  for (let i = 0; i < funcs.length; i++) {
    const func = funcs[i];
    const totals = [0, 0];
    let max = 0;
    let min = Number.MAX_SAFE_INTEGER;

    for (let j = 0; j < opts.runs; j++) {
      const start = process.hrtime();
      func.fn.call(func.bind, func.params);
      const end = process.hrtime(start);

      totals[0] += end[0];
      totals[1] += end[1];

      const ns = (end[0] * NS_PER_SEC) + end[1];
      if (ns > max) max = ns;
      if (ns < min) min = ns;

      updateStatus(++runCount, totalRuns, opts.stream);
    }

    const whole = (totals[0] / opts.runs) * NS_PER_SEC;
    const partial = totals[1] / opts.runs;
    const avg = Math.ceil(whole + partial);

    metrics.push({
      avg,
      label: func.label,
      max,
      min,
    });
  }

  opts.report(opts.stream, metrics, opts.thresholds);
  checkThresholds(metrics, opts.thresholds);

  return metrics;
}
470188
function() {

		var binding = this.binding;

		var buffer = this.buffer,
			stride = this.valueSize,

			originalValueOffset = stride * 3;

		binding.getValue( buffer, originalValueOffset );

		// accu[0..1] := orig -- initially detect changes against the original
		for ( var i = stride, e = originalValueOffset; i !== e; ++ i ) {

			buffer[ i ] = buffer[ originalValueOffset + ( i % stride ) ];

		}

		this.cumulativeWeight = 0;

	}
601968
def perform(action, options = {})
      return unless %i[
        backtrace
        down
        finish
        frame
        next
        step
        up
      ].include?(action)

      send("perform_#{action}", options)
    end
169362
private void rotatorPushRight( int m )
    {
        double b11 = off[m];
        double b21 = diag[m+1];

        computeRotator(b21,-b11);

        // apply rotator on the right
        off[m] = 0;
        diag[m+1] = b21*c-b11*s;

        if( m+2 < N) {
            double b22 = off[m+1];
            off[m+1] = b22*c;
            bulge =  b22*s;
        }  else {
            bulge = 0;
        }

//        SimpleMatrix Q = createQ(m,m+1, c, s, true);
//        B=Q.mult(B);
//
//        B.print();
//        printMatrix();
//        System.out.println("  bulge = "+bulge);
//        System.out.println();

        if( Ut != null ) {
            updateRotator(Ut,m,m+1,c,s);

//            SimpleMatrix.wrap(Ut).mult(B).mult(SimpleMatrix.wrap(Vt).transpose()).print();
//            printMatrix();
//            System.out.println("bulge = "+bulge);
//            System.out.println();
        }
    }
165588
private static boolean pointEqualsPoint_(Point2D pt_a, Point2D pt_b,
			double tolerance, ProgressTracker progress_tracker) {
		if (Point2D.sqrDistance(pt_a, pt_b) <= tolerance * tolerance)
			return true;

		return false;
	}
921385
function RigidBody(_aabb, mass, friction, restitution, gravMult, onCollide, autoStep) {
    this.aabb = new aabb(_aabb.base, _aabb.vec) // clone
    this.mass = mass
    this.friction = friction
    this.restitution = restitution
    this.gravityMultiplier = gravMult
    this.onCollide = onCollide
    this.autoStep = !!autoStep
    this.airDrag = -1   // overrides global airDrag when >= 0
    this.fluidDrag = -1 // overrides global fluidDrag when >= 0
    this.onStep = null
    
    // internals
    this.velocity = vec3.create()
    this.resting = [0, 0, 0]
    this.inFluid = false
    this._ratioInFluid = 0
    this._forces = vec3.create()
    this._impulses = vec3.create()
    this._sleepFrameCount = 10 | 0
}