Returns the number of values in a record, using a given VDR
        dictionary. Multiplies the dimension sizes of each dimension,
        if it is varying.
503940
def _num_values(self, vdr_dict):
        '''
        
        '''
        values = 1
        for x in range(0, vdr_dict['num_dims']):
            if (vdr_dict['dim_vary'][x] != 0):
                values = values * vdr_dict['dim_sizes'][x]
        return values
926162
def calculate_dimensions(variables):
    
    dims = OrderedDict()
    last_used = {}
    scalar_vars = set(k for k, v in variables.items() if not v.dims)
    for k, var in variables.items():
        for dim, size in zip(var.dims, var.shape):
            if dim in scalar_vars:
                raise ValueError('dimension %r already exists as a scalar '
                                 'variable' % dim)
            if dim not in dims:
                dims[dim] = size
                last_used[dim] = k
            elif dims[dim] != size:
                raise ValueError('conflicting sizes for dimension %r: '
                                 'length %s on %r and length %s on %r' %
                                 (dim, size, k, dims[dim], last_used[dim]))
    return dims
705484
def _get_val(record, keys):
    '''
    
    '''
    data = record
    for key in keys:
        if key in data:
            data = data[key]
        else:
            return None
    return data
958897
def get_discrete_dims(self):
        
        discrete_dims = []
        for i in range(self.dimensionality):
            if self.space_expanded[i].type == 'discrete':
                discrete_dims += [i]
        return discrete_dims
938869
def count_dimensions(entry):
    
    result = 0
    for e in entry:
        if isinstance(e, str):
            sliced = e.strip(",").split(",")
            result += 0 if len(sliced) == 1 and sliced[0] == "" else len(sliced)
    return result
608838
def populate_records(self):
        

        self.object_list = self.get_valuesqueryset(self.object_list)
        super(ValuesDatatable, self).populate_records()
1079147
def number_of_interactions(records, direction=None):
    
    if direction is None:
        return len(records)
    else:
        return len([r for r in records if r.direction == direction])
849074
def get_dimension(data):
    
    result = [0, 0]

    if isinstance(data, list):
        result = get_dimension_array(data)

    elif isinstance(data, dict):
        result = get_dimension_dict(data)

    return result
499724
def _count(dicts):
    
    counts = defaultdict(int)
    for d in dicts:
        for k, v in d.items():
            counts[k] += v
    return counts
781449
def store_index   #:nodoc:
    return unless compatibility?

    indices     = @db_indices
    reserved    = 0x00000000
    row_min     = @dimension.row_min
    row_max     = @dimension.row_max

    record      = 0x020B                 # Record identifier
    length      = 16 + 4 * indices.size  # Bytes to follow

    header      = [record, length].pack('vv')
    data        = [reserved, row_min, row_max, reserved].pack('VVVV')

    indices.each do |index|
      data += [index + @offset + 20 + length + 4].pack('V')
    end

    prepend(header, data)
  end
1374350
function maxRecordNumber (args) {
    // get sql
    var select = sql.maxRecordNumber(this, args)
    // do query
    return this.mysql().query(select.sql, select.params)
    // get n value from response
    .then(res => {
        return res[0][0].n
    })
}
256171
def recarray(self):
        """"""
        return numpy.rec.fromrecords(self.records, names=self.names)
532406
public long numRecords() {
        if (numRecords == null) {
            try {
                numRecords = indexToKey.getNumRecords();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return numRecords;
    }
514997
def _do_scatter_var(v, parallel):
    
    # For batches, scatter records only at the top level (double nested)
    if parallel.startswith("batch") and workflow.is_cwl_record(v):
        return (tz.get_in(["type", "type"], v) == "array" and
                tz.get_in(["type", "type", "type"], v) == "array")
    # Otherwise, scatter arrays
    else:
        return (tz.get_in(["type", "type"], v) == "array")
204602
def value_count(x, value):
    
    if not isinstance(x, (np.ndarray, pd.Series)):
        x = np.asarray(x)

    if np.isnan(value):
        return np.isnan(x).sum()
    else:
        return x[x == value].size
686477
def static_dimensions(self):
        
        dimensions = []
        for dim in self.kdims:
            if len(set(self.dimension_values(dim.name))) == 1:
                dimensions.append(dim)
        return dimensions
631179
private ValueFrequency getDistinctValueCount(final ValueCountingAnalyzerResult res) {
        int distinctValueCounter = 0;
        ValueFrequency valueCount = null;
        if (res.getNullCount() > 0) {
            distinctValueCounter++;
            valueCount = new SingleValueFrequency(LabelUtils.NULL_LABEL, res.getNullCount());
        }
        final int uniqueCount = res.getUniqueCount();
        if (uniqueCount > 0) {
            if (uniqueCount > 1) {
                // more than one distinct value
                return null;
            }
            distinctValueCounter++;
            final Collection<String> uniqueValues = res.getUniqueValues();
            String label = LabelUtils.UNIQUE_LABEL;
            if (!uniqueValues.isEmpty()) {
                label = uniqueValues.iterator().next();
            }
            valueCount = new CompositeValueFrequency(label, 1);
        }

        if (distinctValueCounter > 1) {
            // more than one distinct value
            return null;
        }

        final Collection<ValueFrequency> valueCounts = res.getValueCounts();
        if (valueCounts.size() > 0) {
            distinctValueCounter += valueCounts.size();
            valueCount = valueCounts.iterator().next();
        }
        if (distinctValueCounter > 1) {
            // more than one distinct value
            return null;
        }
        return valueCount;
    }