Dict length in items (estimate).
970424
def _len_dict(obj):
    '''
    '''
    n = len(obj)  # active items
    if n < 6:  # ma_smalltable ...
       n = 0  # ... in basicsize
    else:  # at least one unused
       n = _power2(n + 1)
    return n
498969
def _len_list(obj):
    '''
    '''
    n = len(obj)
     # estimate over-allocation
    if n > 8:
       n += 6 + (n >> 3)
    elif n:
       n += 4
    return n
1065355
def get_size(item):
    """"""
    if isinstance(item, (list, set, tuple, dict)):
        return len(item)
    elif isinstance(item, (ndarray, MaskedArray)):
        return item.shape
    elif isinstance(item, Image):
        return item.size
    if isinstance(item, (DataFrame, Index, Series)):
        return item.shape
    else:
        return 1
364203
def itemsize(obj, **opts):
    '''
    '''
    v = _typedefof(obj, **opts)
    if v:
        v = v.item
    return v
521192
def _raw_dimensions(self):
        """"""
        return tuple(
            _RawDimension(dimension_dict, self._dimension_dicts)
            for dimension_dict in self._dimension_dicts
        )
1302171
def _calculate_average_field_lengths(self):
        """"""
        accumulator = defaultdict(int)
        documents_with_field = defaultdict(int)

        for field_ref, length in self.field_lengths.items():
            _field_ref = FieldRef.from_string(field_ref)
            field = _field_ref.field_name

            documents_with_field[field] += 1
            accumulator[field] += length

        for field_name in self._fields:
            accumulator[field_name] /= documents_with_field[field_name]

        self.average_field_length = accumulator
1358299
def get_length(topics, yaml_info):
    '''
    
    '''
    total = 0
    info = yaml_info['topics']
    for topic in topics:
        for t in info:
            if t['topic'] == topic:
                total = total + t['messages']
                break
    return total
831312
function length(item) {
        if (!validateHelpers.isUndefined(item.length)) {
            return item.length;
        }

        if (validateHelpers.isObject(item)) {
            return Object.keys(item).length;
        }

        return 0;
    }
419088
def asDict(self):
        
        d = {}
        for k, v in self.items():
            d[k] = v
        return d
1081573
def get_size(self):
        """"""
        self.curses.setupterm()
        return self.curses.tigetnum('cols'), self.curses.tigetnum('lines')
299531
def iteritems(self):
        """"""
        for key in self:
            vals = _dict_getitem(self, key)
            for val in vals[1:]:
                yield vals[0], val
9417
def lengths_offsets(value):
    
    values = []
    for item in value.split(','):
        item = int(item)
        values.append(item)
    return values
1115401
def calculate_size(name, items):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += INT_SIZE_IN_BYTES
    for items_item in items:
        data_size += calculate_size_data(items_item)
    return data_size
44742
def _filtdim(items, shape, dim, nsl):
    """"""
    normshape = tuple(stop - start for start, stop in shape)
    nsl_type = type(nsl)
    newitems = list()
    # Number of groups
    num = reduce(operator.mul, normshape[:dim+1])
    # Size of each group
    size = len(items) // num
    # Size of the dimension
    n = normshape[dim]
    if nsl_type is int:
        for i in range(num):
            if i % n == nsl:
                newitems += items[size*i:size*(i+1)]
        # Collapse dimension
        newshape = shape[:dim] + shape[dim+1:]
    elif nsl_type is slice:
        for i in range(num):
            if nsl.start <= (i % n) < nsl.stop:
                newitems += items[size*i:size*(i+1)]
        # Reshape dimension
        offset = shape[dim][0]
        redim = (offset + nsl.start, offset + nsl.stop)
        newshape = shape[:dim] + (redim, ) + shape[dim+1:]
    # farray
    else:
        if nsl.size < clog2(n):
            fstr = "expected dim {} select to have >= {} bits, got {}"
            raise ValueError(fstr.format(dim, clog2(n), nsl.size))
        groups = [list() for _ in range(n)]
        for i in range(num):
            groups[i % n] += items[size*i:size*(i+1)]
        for muxins in zip(*groups):
            it = boolfunc.iter_terms(nsl._items)
            xs = [reduce(operator.and_, (muxin, ) + next(it))
                  for muxin in muxins]
            newitems.append(reduce(operator.or_, xs))
        # Collapse dimension
        newshape = shape[:dim] + shape[dim+1:]
    return newitems, newshape
153278
def str_dict(some_dict):
    """"""
    return {str(k): str(v) for k, v in some_dict.items()}
74470
def values(self) -> typing.Dict[str, str]:
        """"""
        return {k: v for k, v in self._items if v is not None}
337531
def __item_data(self, model, index):
        """"""
        item = model.items[index]

        data = {
            "name": item.name,
            "data": item.data,
            "doc": getattr(item, "doc", None),
            "path": getattr(item, "path", None),
        }

        return data