Checks node local collection storage sizes
978959
def _check_collections(self):
        """"""

        self.collection_sizes = {}
        self.collection_total = 0
        for col in self.db.collection_names(include_system_collections=False):
            self.collection_sizes[col] = self.db.command('collstats', col).get(
                'storageSize', 0)
            self.collection_total += self.collection_sizes[col]

        sorted_x = sorted(self.collection_sizes.items(),
                          key=operator.itemgetter(1))

        for item in sorted_x:
            self.log("Collection size (%s): %.2f MB" % (
                item[0], item[1] / 1024.0 / 1024),
                     lvl=verbose)

        self.log("Total collection sizes: %.2f MB" % (self.collection_total /
                                                      1024.0 / 1024))
976948
def fetch_size fsz, &block
    obj = self.dup
    obj.instance_variable_set :@fetch_size, fsz
    ret obj, &block
  end
346337
def size(self):
        ''''''
        if self.cache.cache is None:
            return self.read_backend_structure().size()
        else:
            return len(self.cache.cache)
288563
function parseExtensions(collection, extensions) {
  extensions.forEach(extNode => {
    const ext = new AdExtension();
    const extNodeAttrs = extNode.attributes;
    const childNodes = extNode.childNodes;

    if (extNode.attributes) {
      for (const extNodeAttrKey in extNodeAttrs) {
        const extNodeAttr = extNodeAttrs[extNodeAttrKey];

        if (extNodeAttr.nodeName && extNodeAttr.nodeValue) {
          ext.attributes[extNodeAttr.nodeName] = extNodeAttr.nodeValue;
        }
      }
    }

    for (const childNodeKey in childNodes) {
      const childNode = childNodes[childNodeKey];
      const txt = parserUtils.parseNodeText(childNode);

      // ignore comments / empty value
      if (childNode.nodeName !== '#comment' && txt !== '') {
        const extChild = new AdExtensionChild();
        extChild.name = childNode.nodeName;
        extChild.value = txt;

        if (childNode.attributes) {
          const childNodeAttributes = childNode.attributes;

          for (const extChildNodeAttrKey in childNodeAttributes) {
            const extChildNodeAttr = childNodeAttributes[extChildNodeAttrKey];

            extChild.attributes[extChildNodeAttr.nodeName] =
              extChildNodeAttr.nodeValue;
          }
        }

        ext.children.push(extChild);
      }
    }

    collection.push(ext);
  });
}
1199361
protected void checkCollectionType(Collection c) {
        if (type != null) {
            for (Object element : c) {
                checkType(element);
            }
        }
    }
122835
def check_downloaded_files_sizes(self):
        
        for file_url in self.file_urls:
            local_path = file_url.get_local_path(self.dest_directory)
            self.check_file_size(file_url.size, local_path)
1126468
public void setStorageSize(java.util.Collection<Range> storageSize) {
        if (storageSize == null) {
            this.storageSize = null;
            return;
        }

        this.storageSize = new java.util.ArrayList<Range>(storageSize);
    }
865353
public static int getSparseStorageSize(int nonEmptyBuckets)
  {
    return COMMON_FIELDS_SIZE +
           Integer.BYTES +
           (Integer.BYTES + Long.BYTES) * nonEmptyBuckets;
  }
1052937
def BytesSizer(field_number, is_repeated, is_packed):
  """"""

  tag_size = _TagSize(field_number)
  local_VarintSize = _VarintSize
  local_len = len
  assert not is_packed
  if is_repeated:
    def RepeatedFieldSize(value):
      result = tag_size * len(value)
      for element in value:
        l = local_len(element)
        result += local_VarintSize(l) + l
      return result
    return RepeatedFieldSize
  else:
    def FieldSize(value):
      l = local_len(value)
      return tag_size + local_VarintSize(l) + l
    return FieldSize
381632
int size() {
        int res = m_subscriptions.size();
        for (TreeNode child : m_children) {
            res += child.size();
        }
        return res;
    }
638533
def use_size(self):
        ""
        if self._nodes is None:
            return self._use_size
        return sum(i.use_size() for i in self._nodes)
1263617
def local_data(path):
    """"""
    dirs = [os.path.join(path, item) for item in os.listdir(path)]
    names, sizes, files = zip(*[(dir.split('/')[-1], str(get_size(dir)),
                                 '##'.join([file for file in os.listdir(dir)]))
                                for dir in dirs])
    return zip(names, dirs, sizes, files)
944241
def list_nodes_full(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The list_nodes_full function must be called with -f or --function.'
        )

    netapi_versions = get_api_versions(kwargs={
        'resource_provider': 'Microsoft.Network',
        'resource_type': 'networkInterfaces'
        }
    )
    netapi_version = netapi_versions[0]
    compconn = get_conn(client_type='compute')

    ret = {}

    def _get_node_info(node):
        '''
        Get node info.
        '''
        node_ret = {}
        node['id'] = node['vm_id']
        node['size'] = node['hardware_profile']['vm_size']
        node['state'] = node['provisioning_state']
        node['public_ips'] = []
        node['private_ips'] = []
        node_ret[node['name']] = node
        try:
            image_ref = node['storage_profile']['image_reference']
            node['image'] = '|'.join([
                image_ref['publisher'],
                image_ref['offer'],
                image_ref['sku'],
                image_ref['version'],
            ])
        except (TypeError, KeyError):
            try:
                node['image'] = node['storage_profile']['os_disk']['image']['uri']
            except (TypeError, KeyError):
                node['image'] = node.get('storage_profile', {}).get('image_reference', {}).get('id')
        try:
            netifaces = node['network_profile']['network_interfaces']
            for index, netiface in enumerate(netifaces):
                netiface_name = get_resource_by_id(
                    netiface['id'],
                    netapi_version,
                    'name'
                )
                netiface, pubips, privips = _get_network_interface(
                    netiface_name,
                    node['resource_group']
                )
                node['network_profile']['network_interfaces'][index].update(netiface)
                node['public_ips'].extend(pubips)
                node['private_ips'].extend(privips)
        except Exception:
            pass

        node_ret[node['name']] = node

        return node_ret

    for group in list_resource_groups():
        nodes = []
        nodes_query = compconn.virtual_machines.list(
            resource_group_name=group
        )
        for node_obj in nodes_query:
            node = node_obj.as_dict()
            node['resource_group'] = group
            nodes.append(node)

        pool = ThreadPool(cpu_count() * 6)
        results = pool.map_async(_get_node_info, nodes)
        results.wait()

        group_ret = {k: v for result in results.get() for k, v in six.iteritems(result)}
        ret.update(group_ret)

    return ret
578579
@SuppressWarnings("PMD.UnusedLocalVariable")
  public static <T> int size(Iterable<T> iter) {
    if (iter instanceof ArrayTagSet) {
      return ((ArrayTagSet) iter).size();
    } else if (iter instanceof Collection<?>) {
      return ((Collection<?>) iter).size();
    } else {
      int size = 0;
      for (T v : iter) {
        ++size;
      }
      return size;
    }
  }
313186
function assertCollectionSizeLeast(_super) {
    return function(n) {
      if (utils.flag(this, 'immutable.collection.size')) {
        assertIsIterable(this._obj);

        const { size } = this._obj;
        new Assertion(size).a('number');

        this.assert(
          size >= n,
          'expected #{this} to have a size of at least #{exp} but got #{act}',
          'expected #{this} to not have a size of at least #{exp} but got ' +
            '#{act}',
          n,
          size
        );
      } else {
        _super.apply(this, arguments);
      }
    };
  }
861538
function getSize(node) {
  return (node.loc.end.line - node.loc.start.line) + 1;
}
44803
def get_local_gb(system_obj):
    
    local_max_bytes = 0
    logical_max_mib = 0
    volume_max_bytes = 0
    physical_max_mib = 0
    drives_max_bytes = 0
    simple_max_bytes = 0

    # Gets the resources and properties
    # its quite possible for a system to lack the resource, hence its
    # URI may also be lacking.

    # Check if smart_storage resource exist at the system
    smart_resource = _get_attribute_value_of(system_obj, 'smart_storage')
    # Check if storage resource exist at the system
    storage_resource = _get_attribute_value_of(system_obj, 'storages')

    if smart_resource is not None:
        logical_max_mib = _get_attribute_value_of(
            smart_resource, 'logical_drives_maximum_size_mib', default=0)
    if storage_resource is not None:
        volume_max_bytes = _get_attribute_value_of(
            storage_resource, 'volumes_maximum_size_bytes', default=0)

    # Get the largest volume from the system.
    local_max_bytes = utils.max_safe([(logical_max_mib * 1024 * 1024),
                                     volume_max_bytes])
    # if volume is not found, then traverse through the possible disk drives
    # and get the biggest disk.
    if local_max_bytes == 0:
        if smart_resource is not None:
            physical_max_mib = _get_attribute_value_of(
                smart_resource, 'physical_drives_maximum_size_mib', default=0)

        if storage_resource is not None:
            drives_max_bytes = _get_attribute_value_of(
                storage_resource, 'drives_maximum_size_bytes', default=0)

        # Check if the SimpleStorage resource exist at the system.
        simple_resource = _get_attribute_value_of(system_obj,
                                                  'simple_storages')
        if simple_resource is not None:
            simple_max_bytes = _get_attribute_value_of(
                simple_resource, 'maximum_size_bytes', default=0)

        local_max_bytes = utils.max_safe([(physical_max_mib * 1024 * 1024),
                                         drives_max_bytes, simple_max_bytes])
    # Convert the received size to GB and reduce the value by 1 Gb as
    # ironic requires the local_gb to be returned 1 less than actual size.
    local_gb = 0
    if local_max_bytes > 0:
        local_gb = int(local_max_bytes / (1024 * 1024 * 1024)) - 1
    else:
        msg = ('The maximum size for the hard disk or logical '
               'volume could not be determined.')
        LOG.debug(msg)
    return local_gb