def dep_attrs(self, resource_name, load_all=False): """Iterate over attributes of a given resource that this references. Return an iterator over dependent attributes for specified resource_name in resources' properties and metadata fields. """ if self._all_dep_attrs is None and load_all: attr_map = collections.defaultdict(set) atts = itertools.chain(function.all_dep_attrs(self._properties), function.all_dep_attrs(self._metadata)) for res_name, att_name in atts: attr_map[res_name].add(att_name) self._all_dep_attrs = attr_map if self._all_dep_attrs is not None: return self._all_dep_attrs[resource_name] return itertools.chain( function.dep_attrs(self._properties, resource_name), function.dep_attrs(self._metadata, resource_name))
def dep_attrs(self, resource_name, load_all=False): """Iterate over attributes of a given resource that this references. Return an iterator over dependent attributes for specified resource_name in resources' properties and metadata fields. """ if self._all_dep_attrs is None and load_all: attr_map = collections.defaultdict(set) atts = itertools.chain(function.all_dep_attrs(self._properties), function.all_dep_attrs(self._metadata)) for res_name, att_name in atts: attr_map[res_name].add(att_name) self._all_dep_attrs = attr_map if self._all_dep_attrs is not None: return self._all_dep_attrs[resource_name] return itertools.chain(function.dep_attrs(self._properties, resource_name), function.dep_attrs(self._metadata, resource_name))
def dep_attrs(self, resource_name, load_all=False): """Iterate over attributes of a given resource that this references. Return an iterator over dependent attributes for specified resource_name in the output's value field. """ if self._all_dep_attrs is None and load_all: attr_map = collections.defaultdict(set) for r, a in function.all_dep_attrs(self._value): attr_map[r].add(a) self._all_dep_attrs = attr_map if self._all_dep_attrs is not None: return iter(self._all_dep_attrs.get(resource_name, [])) return function.dep_attrs(self._value, resource_name)