def entity_names( self, downstream_of=None, upstream_of=None, with_children=None): names = set(self._entities_by_name.keys()) if upstream_of is not None: bot_names = interpret.str_or_seq_as_list(upstream_of) upstream_names = set() for bot_name in bot_names: bot_entity = self._entities_by_name[bot_name] upstream_names |= bot_entity.all_upstream_names names = names & upstream_names if downstream_of is not None: top_names = interpret.str_or_seq_as_list(downstream_of) downstream_names = set() for top_name in top_names: top_entity = self._entities_by_name[top_name] downstream_names |= top_entity.all_downstream_names names = names & downstream_names if with_children is not None: names_with_children = set( name for name in names if len(self._entities_by_name[name].child_names) > 0 ) if with_children: names = names_with_children else: names -= names_with_children return list(sorted(names))
def nondeterministic_upstream_entity_names(self, upstream_of): bot_names = interpret.str_or_seq_as_list(upstream_of) upstream_names = set() for bot_name in bot_names: bot_entity = self._entities_by_name[bot_name] upstream_names |= bot_entity.all_nondeterministic_upstream_names return upstream_names
def __init__(self, flow, tier=["local", "cloud"]): self.flow = flow self._old_entries = set() self._tiers = interpret.str_or_seq_as_list(tier)