Return the number of fields and size (not yet) of a compound type.
194467
def inq_compound(self, name):
        
        name = create_string_buffer(name)
        self.library.inq_compound.argtypes = [c_char_p, POINTER(c_int)]
        self.library.inq_compound.restype = None
        nfields = c_int()
        self.library.inq_compound(name, byref(nfields))
        return nfields.value
679158
def num_columns(self):
        """"""
        if self.term.is_a_tty:
            return self.term.width // self.hint_width
        return 1
1263316
def number_of_statements(self, n):
        """"""
        stmt_type = n.type
        if stmt_type == syms.compound_stmt:
            return 1
        elif stmt_type == syms.stmt:
            return self.number_of_statements(n.children[0])
        elif stmt_type == syms.simple_stmt:
            # Divide to remove semi-colons.
            return len(n.children) // 2
        else:
            raise AssertionError("non-statement node")
672
def get_size(objects):
    """"""
    res = 0
    for o in objects:
        try:
            res += _getsizeof(o)
        except AttributeError:
            print("IGNORING: type=%s; o=%s" % (str(type(o)), str(o)))
    return res
795030
public int getFieldCount()
	{
		int result = 0;
		for(Argument a : arguments)
		{
			if(a instanceof FactoryDefinition.SerializedArgument)
			{
				result++;
			}
		}
		return result;
	}
930726
public int size() {
		int result = 0;
		for (O o : multiplicities.keySet()) {
			result += multiplicity(o);
		}
		return result;
	}
1005034
def count(self):
        """"""
        if self._primary_keys is None:
            return self.queryset.count()
        else:
            return len(self.pks)
980548
private int getDynamicFieldSize(Object obj, Charset charset)
            throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
        int size = 0;
        for (FieldMetaData field : dynamicFieldList) {
            size = size + field.getDynamicFieldByteSize(obj, charset);
        }
        return size;
    }
1197122
def size(self):
        
        return len(self._query_compiler.index) * len(self._query_compiler.columns)
1188706
def count(self):
        '''
        
        '''
        args = self.format_args
        if args is None or \
                (isinstance(args, dict) and self.count_field not in args):
            raise TypeError("count is required")
        return args[self.count_field] if isinstance(args, dict) else args
1056213
public int size() {
        int ele, count;

        count = 0;
        for (ele = first(); ele != -1; ele = next(ele)) {
            count++;
        }
        return count;
    }
359851
def count_by_type(self):
        """"""
        saltbridges = defaultdict(int)
        for contact in self.timeseries:
            #count by residue name not by proteinring
            pkey = (contact.ligandatomid,contact.ligandatomname, contact.resid,contact.resname,contact.segid)
            saltbridges[pkey]+=1
        dtype = [("ligand_atom_id",int),("ligand_atom_name","|U4"),("resid",int),("resname","|U4"),("segid","|U8"),("frequency",float) ]
        out = np.empty((len(saltbridges),),dtype=dtype)
        tsteps = float(len(self.timesteps))
        for cursor,(key,count) in enumerate(saltbridges.iteritems()):
            out[cursor] = key + (count / tsteps,)
        return out.view(np.recarray)
481712
function(){
        var fieldNames = [], i, n = this._fieldCount;
        for (i = 0; i < n; i++) fieldNames[i] = this.fieldOrder[i];
        return fieldNames;
    }
486669
def get_fields(self):
        """"""

        def visitor(field, children):
            assert field != conf.lib.clang_getNullCursor()

            # Create reference to TU so it isn't GC'd before Cursor.
            field._tu = self._tu
            fields.append(field)
            return 1 # continue
        fields = []
        conf.lib.clang_Type_visitFields(self,
                            callbacks['fields_visit'](visitor), fields)
        return iter(fields)
652147
def total_size(obj):
  """"""
  seen = set()
  def sizeof(current_obj):
    try:
      return _sizeof(current_obj)
    except Exception:  # pylint: disable=broad-except
      # Not sure what just happened, but let's assume it's a reference.
      return struct.calcsize('P')

  def _sizeof(current_obj):
    """Do a depth-first acyclic traversal of all reachable objects."""
    if id(current_obj) in seen:
      # A rough approximation of the size cost of an additional reference.
      return struct.calcsize('P')
    seen.add(id(current_obj))
    size = sys.getsizeof(current_obj)

    if isinstance(current_obj, dict):
      size += sum(map(sizeof, itertools.chain.from_iterable(
          six.iteritems(current_obj))))
    elif (isinstance(current_obj, collections.Iterable) and
          not isinstance(current_obj, six.string_types)):
      size += sum(sizeof(item) for item in current_obj)
    elif isinstance(current_obj, records.RecordClass):
      size += sum(sizeof(getattr(current_obj, attr))
                  for attr in current_obj.__slots__)
    return size

  return sizeof(obj)
530540
def base_fields(self):
        ''''''
        if self.extensions_start is None:
            return len(self.fields)
        return len(self.fields[:self.extensions_start])
894189
def size(self, value):
		
		
		if self._combining:  # We are a field-compound query fragment, e.g. (Foo.bar & Foo.baz).
			return reduce(self._combining, (q.size(value) for q in self._field))
		
		# Optimize this away in production; diagnosic aide.
		if __debug__ and _complex_safety_check(self._field, {'$size', '#array'}):  # pragma: no cover
			raise NotImplementedError("{self!r} does not allow $size comparison.".format(self=self))
		
		return Filter({self._name: {'$size': int(value)}})