def get_num_events(snapshot): """ Get the num of events a snapshot is going to produce, by knowing how many tests and erasures are in there. todo: compute add/Remove and other events, not just tests. :param snapshot: :return: """ values = NestedLookup(snapshot, [], NestedLookup.key_equality_factory('test')) values += NestedLookup(snapshot, [], NestedLookup.key_equality_factory('erasure')) return len(values) + 1 # 1 == register event itself
def actual_fields(cls): """ Returns the fields of only this class. """ fields = super(RDFS, cls).actual_fields() if cls._import_schemas: references = [] NestedLookup(fields, references, NestedLookup.is_sub_type_factory(RDFS)) for document, ref_key in references: document[ref_key] = document[ref_key]() return fields