def filter_ids(self, ids, type_and_subtype): ''' returns a filtered subset of ids which have a type_and_subtype that matchs the type_and_subtype argument eg merged_ecal_ids = filter_ids(ids, 'em') @param ids: a list of ids @param type_and_subtype: a two letter type and subtype eg 'es' for smeared ecal ''' return [uid for uid in ids if Identifier.type_and_subtype(uid) == type_and_subtype]
def get_object(self, uid): '''get an object corresponding to a unique uid''' #I am still not sure about this #would it be better to let it fail when asking for something that does not exist like this: # return self.get_collections(Identifier.type_and_subtype(uid))[uid] # collection = self.get_collection(Identifier.type_and_subtype(uid)) if collection: return collection.get(uid, None) return None
def filter_ids(self, ids, type_and_subtype): ''' returns a filtered subset of ids which have a type_and_subtype that matchs the type_and_subtype argument eg merged_ecal_ids = filter_ids(ids, 'em') @param ids: a list of ids @param type_and_subtype: a two letter type and subtype eg 'es' for smeared ecal ''' return [ uid for uid in ids if Identifier.type_and_subtype(uid) == type_and_subtype ]
def type_and_subtype(self, node): ''' Return two letter type and subtype code for a node For example 'pg', 'ht' etc @param node: a node in the DAG history''' return Identifier.type_and_subtype(node.get_value())