A generator that will generate a range of floats.
354658
def frange(start, stop, step, precision):
    """"""
    value = start
    while round(value, precision) < stop:
        yield round(value, precision)
        value += step
780334
private Expr generateQuantifierRanges(WyilFile.Expr.Quantifier expr, LocalEnvironment environment) {
		Expr ranges = null;
		Tuple<WyilFile.Decl.Variable> parameters = expr.getParameters();
		for (int i = 0; i != parameters.size(); ++i) {
			WyilFile.Decl.Variable var = parameters.get(i);
			WyilFile.Expr.ArrayRange range = (WyilFile.Expr.ArrayRange) var.getInitialiser();
			WyalFile.VariableDeclaration varDecl = environment.read(var);
			Expr.VariableAccess varExpr = new Expr.VariableAccess(varDecl);
			Expr startExpr = translateExpression(range.getFirstOperand(), null, environment);
			Expr endExpr = translateExpression(range.getSecondOperand(), null, environment);
			Expr lhs = new Expr.LessThanOrEqual(startExpr, varExpr);
			Expr rhs = new Expr.LessThan(varExpr, endExpr);
			ranges = and(ranges, and(lhs, rhs));
		}
		return ranges;
	}
276803
def generate_numeric_range(items, lower_bound, upper_bound):
    

    quantile_grid = create_quantiles(items, lower_bound, upper_bound)
    labels, bounds = (zip(*quantile_grid))
    ranges = ((label, NumericRange(*bound))
              for label, bound in zip(labels, bounds))
    return ranges
749030
def float_range(value):
    
    try:
        value = float(value)
    except Exception:
        raise argparse.ArgumentTypeError('Invalid float value: \'{}\''.format(value))
    if value < 0.0 or value > 1.0:
        raise argparse.ArgumentTypeError('Invalid float value: \'{}\''.format(value))
    return value
1094509
def _pooling_output_shape(input_shape, pool_size=(2, 2),
                          strides=None, padding='VALID'):
  """"""
  dims = (1,) + pool_size + (1,)  # NHWC
  spatial_strides = strides or (1,) * len(pool_size)
  strides = (1,) + spatial_strides + (1,)
  pads = padtype_to_pads(input_shape, dims, strides, padding)
  operand_padded = onp.add(input_shape, onp.add(*zip(*pads)))
  t = onp.floor_divide(onp.subtract(operand_padded, dims), strides) + 1
  return tuple(t)
1196407
def generator(self, t):
        """"""
        a = (np.exp(-self.theta * t) - 1) / (np.exp(-self.theta) - 1)
        return -np.log(a)
656365
def _fmt_float(cls, x, **kw):
        
        n = kw.get('n')
        return '%.*f' % (n, cls._to_float(x))
299449
def ScreenGenerator(nfft, r0, nx, ny):
    """"""
    while 1:
        layers = GenerateTwoScreens(nfft, r0)
        for iLayer in range(2):
            for iy in range(int(nfft/ny)):
                for ix in range(int(nfft/nx)):
                    yield layers[iLayer][iy*ny:iy*ny+ny, ix*nx:ix*nx+nx]
872063
def _sampleRange(rng, start, end, step, k):
  
  array = numpy.empty(k, dtype="uint32")
  rng.sample(numpy.arange(start, end, step, dtype="uint32"), array)
  return array
1010383
def read_numbers(numbers):
    
    if isiterable(numbers):
        for number in numbers:
            yield float(str(number).strip())
    else:
        with open(numbers) as fh:
            for number in fh:
                yield float(number.strip())
801623
def simple_round_factory(tol):
    """"""
    def simple_round(*args, **kwds):
        argstype = type(args)
        _args = list(args)
        _kwds = kwds.copy()
        for i,j in enumerate(args): # args[0] is the class.
            if isinstance(j, float): _args[i] = round(j, tol[i - 1] \
                if isinstance(tol, (list, tuple)) else tol) # don't round int
        for k, (i,j) in enumerate(kwds.items()):
            if isinstance(j, float): _kwds[i] = round(j, tol[k] \
                if isinstance(tol, (list, tuple)) else tol)
        return argstype(_args), _kwds
    return simple_round
474502
private float limit(float value, float min, float max) {
    return Math.min(Math.max(min, value), max);
  }
72181
def waverange(self):
        """"""
        if self.waveset is None:
            x = [None, None]
        else:
            x = u.Quantity([self.waveset.min(), self.waveset.max()])
        return x
766799
def create_float(self, value: float) -> Float:
        
        self.append((4, value))
        return self.get(self.raw_count - 1)
1075674
def p_ConstValue_float(p):
  """"""
  p[0] = model.Value(type=model.Value.FLOAT, value=p[1])
860021
def round_to_float(number, precision):
    """"""
    rounded = Decimal(str(floor((number + precision / 2) // precision))
                      ) * Decimal(str(precision))
    return float(rounded)
671118
def polygon_generator(data, scale, style, permutation=None):
    """"""

    # We'll project the coordinates inside this function to prevent
    # passing around permutation more than necessary
    project = functools.partial(project_point, permutation=permutation)

    if isinstance(data, dict):
        data_gen = data.items()
    else:
        # Only works with style == 'h'
        data_gen = data

    for key, value in data_gen:
        if value is None:
            continue
        i = key[0]
        j = key[1]
        k = scale - i - j
        if style == 'h':
            vertices = hexagon_coordinates(i, j, k)
            yield (map(project, vertices), value)
        elif style == 'd':
            # Upright triangles
            if (i <= scale) and (j <= scale) and (k >= 0):
                vertices = triangle_coordinates(i, j, k)
                yield (map(project, vertices), value)
            # Upside-down triangles
            if (i < scale) and (j < scale) and (k >= 1):
                vertices = alt_triangle_coordinates(i, j, k)
                value = blend_value(data, i, j, k)
                yield (map(project, vertices), value)
        elif style == 't':
            # Upright triangles
            if (i < scale) and (j < scale) and (k > 0):
                vertices = triangle_coordinates(i, j, k)
                value = blend_value(data, i, j, k)
                yield (map(project, vertices), value)
            # If not on the boundary add the upside-down triangle
            if (i < scale) and (j < scale) and (k > 1):
                vertices = alt_triangle_coordinates(i, j, k)
                value = alt_blend_value(data, i, j, k)
                yield (map(project, vertices), value)