Returns the low interval (inclusive) of the given bucket.
10407
private int bucketLowInterval(final int index) {
    if (index <= num_linear_buckets) {
      return index * interval;
    } else {
      return cutoff + (1 << (index - num_linear_buckets + exp_bucket_shift));
    }
  }
419992
def low(data, **kwargs):
    '''
    
    '''
    st_kwargs = __salt__.kwargs
    __opts__['grains'] = __grains__
    chunks = [data]
    st_ = salt.client.ssh.state.SSHHighState(
            __opts__,
            __pillar__,
            __salt__,
            __context__['fileclient'])
    for chunk in chunks:
        chunk['__id__'] = chunk['name'] if not chunk.get('__id__') else chunk['__id__']
    err = st_.state.verify_data(data)
    if err:
        return err
    file_refs = salt.client.ssh.state.lowstate_file_refs(
            chunks,
            _merge_extra_filerefs(
                kwargs.get('extra_filerefs', ''),
                __opts__.get('extra_filerefs', '')
                )
            )
    roster = salt.roster.Roster(__opts__, __opts__.get('roster', 'flat'))
    roster_grains = roster.opts['grains']

    # Create the tar containing the state pkg and relevant files.
    trans_tar = salt.client.ssh.state.prep_trans_tar(
            __context__['fileclient'],
            chunks,
            file_refs,
            __pillar__,
            st_kwargs['id_'],
            roster_grains)
    trans_tar_sum = salt.utils.hashutils.get_hash(trans_tar, __opts__['hash_type'])
    cmd = 'state.pkg {0}/salt_state.tgz pkg_sum={1} hash_type={2}'.format(
            __opts__['thin_dir'],
            trans_tar_sum,
            __opts__['hash_type'])
    single = salt.client.ssh.Single(
            __opts__,
            cmd,
            fsclient=__context__['fileclient'],
            minion_opts=__salt__.minion_opts,
            **st_kwargs)
    single.shell.send(
            trans_tar,
            '{0}/salt_state.tgz'.format(__opts__['thin_dir']))
    stdout, stderr, _ = single.cmd_block()

    # Clean up our tar
    try:
        os.remove(trans_tar)
    except (OSError, IOError):
        pass

    # Read in the JSON data and return the data structure
    try:
        return salt.utils.json.loads(stdout)
    except Exception as e:
        log.error("JSON Render failed for: %s\n%s", stdout, stderr)
        log.error(six.text_type(e))

    # If for some reason the json load fails, return the stdout
    return stdout
762666
def intervals(_min, _max=None, size=1):
    
    if _max == None:
        _max = _min
        _min = 0
    _max = int(mo_math.ceiling(_max))
    _min = int(mo_math.floor(_min))

    output = ((x, min(x + size, _max)) for x in _range(_min, _max, size))
    return output
407681
public int findLowestKey(int min) {
        int lowest = Integer.MAX_VALUE;
        int index = index(hash(min));
        final int maxTry = capacity;
        for (int i = 0; i < maxTry; i++) {
            if (!slotIsFree(index)) {
                int k = keys[index];
                if (k == min) return min;
                if (min < k && k < lowest) lowest = k;
            }
            index = nextIndex(index);
        }
        return lowest;
    }
966514
public Optional<Double> max() {
        if (isEmpty()) return Optional.empty();
        return Optional.of(buckets_.get(buckets_.size() - 1).getRange().getCeil());
    }
148579
def min(self):
        
        if len(self._data) == 0:
            return 10
        return next(iter(sorted(self._data.keys())))
287414
protected Bucket getBucketForValue(long value) {
		Bucket bucket;
		if (value < min) {
			bucket = buckets[0];
		} else {
			if (value >= max) {
				bucket = buckets[bucketNb + 1];
			} else {
				// Linear interpolation
				int bucketIndex = 1 + (int) ((value - min) * (bucketNb - 1) / (max - min));
				bucket = buckets[bucketIndex];
				// As the division above was round at floor, bucket may be the next one
				if (value > bucket.getMax()) {
					bucketIndex++;
					bucket = buckets[bucketIndex];
				}
			}
		}
		return bucket;
	}
157503
function interval(start, end) {
  if (arguments.length === 1 && typeof start === 'string') {
    return start
  }
  else if (arguments.length === 2) {
    var interval = utils.args(arguments, 0)

    return interval.map(function(original) {
      var arg = utils.date(original)

      if (!arg) {
        throw new FieldError('Bad date specified: ' + original)
      }

      return JSON.stringify(arg).replace(/"/g, '')
    }).join('/')
  }
  else {
    throw new FieldError('Bad arguments')
  }
}
11411
def ranges(self):
        """"""
        bucket_fns = {
            'boolean': linear_buckets,
            'flag': linear_buckets,
            'count': linear_buckets,
            'enumerated': linear_buckets,
            'categorical': linear_buckets,
            'linear': linear_buckets,
            'exponential': exponential_buckets,
        }

        if self._kind not in bucket_fns:
            raise ParserError('Unknown kind "%s" for histogram "%s".' % (self._kind, self._name))

        fn = bucket_fns[self._kind]
        return fn(self.low(), self.high(), self.n_buckets())
188660
def copy(self):
        """"""
        return Interval(self._lower, self._lower_value, self._upper_value, self._upper)
316562
def _range_min(self, p, start, span, i, k):
        
        if start + span <= i or k <= start:        # disjoint intervals
            return self.INF
        if i <= start and start + span <= k:       # included intervals
            return self.s[p]
        left = self._range_min(2 * p, start, span // 2,
                               i, k)
        right = self._range_min(2 * p + 1, start + span // 2, span // 2,
                                i, k)
        return min(left, right)
561969
def lower(self):
        
        q = self.copy()
        q.addFunction(Query.Function.Lower)
        return q
14060
protected Bucket getBucketForValue(long value) {
		Bucket bucket;
		if (value >= max) {
			bucket = buckets[bucketNb + 1];
		} else {
			if (value < min) {
				bucket = buckets[0];
			} else {
				int idx = (int) Math.floor((Math.log(value) - logMin) / power) + 1;
				bucket = buckets[idx];
				if (value >= bucket.getMax()) {
					bucket = buckets[idx + 1];
				}
			}
		}
		return bucket;
	}
137673
def get_bucket(seq_len: int, buckets: List[int]) -> Optional[int]:
    
    bucket_idx = bisect.bisect_left(buckets, seq_len)
    if bucket_idx == len(buckets):
        return None
    return buckets[bucket_idx]
187286
def min_interval(self,name, alpha=_alpha, **kwargs):
        
        data = self.get(name, **kwargs)
        return min_interval(data,alpha)
648269
public Granularity getGranularity() {
        Interval interval = getInterval();
        if (interval != null) {
            return interval.getStartGranularity();
        } else {
            return null;
        }
    }
482950
def interval(best,lo=np.nan,hi=np.nan):
    
    return [float(best),[float(lo),float(hi)]]