Beispiel #1
0
 def dep_attrs(self, resource_name):
     """
     Return an iterator over dependent attributes for specified
     resource_name in resources' properties and metadata fields.
     """
     return itertools.chain(
         function.dep_attrs(self._properties, resource_name),
         function.dep_attrs(self._metadata, resource_name))
Beispiel #2
0
    def dep_attrs(self, resource_name):
        """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.
        """
        return itertools.chain(
            function.dep_attrs(self._properties, resource_name), function.dep_attrs(self._metadata, resource_name)
        )
Beispiel #3
0
    def dep_attrs(self, resource_name):
        """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.
        """
        return function.dep_attrs(self._value, resource_name)
Beispiel #4
0
 def dep_attrs(self, resource_name):
     """Check if there is no attribute_name defined, return empty chain."""
     if self._attribute is not None:
         return super(GetAttAllAttributes, self).dep_attrs(resource_name)
     elif self._resource().name == resource_name:
         res = self._resource()
         attrs = six.iterkeys(res.attributes_schema)
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args, resource_name), attrs)
Beispiel #5
0
 def dep_attrs(self, resource_name):
     """Check if there is no attribute_name defined, return empty chain."""
     if self._attribute is not None:
         return super(GetAttAllAttributes, self).dep_attrs(resource_name)
     elif self._res_name() == resource_name:
         attrs = [attributes.ALL_ATTRIBUTES]
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args, resource_name),
                            attrs)
Beispiel #6
0
 def dep_attrs(self, resource_name):
     """Check if there is no attribute_name defined, return empty chain."""
     if self._attribute is not None:
         return super(GetAttAllAttributes, self).dep_attrs(resource_name)
     elif self._res_name() == resource_name:
         attrs = [attributes.ALL_ATTRIBUTES]
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args,
                                               resource_name), attrs)
Beispiel #7
0
 def dep_attrs(self, resource_name):
     """Check if there is no attribute_name defined, return empty chain."""
     if self._attribute is not None:
         return super(GetAttAllAttributes, self).dep_attrs(resource_name)
     elif self._resource().name == resource_name:
         res = self._resource()
         attrs = six.iterkeys(res.attributes_schema)
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args, resource_name),
                            attrs)
Beispiel #8
0
    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))
Beispiel #9
0
 def dep_attrs(self, resource_name):
     if self._resource().name == resource_name:
         path = function.resolve(self._path_components)
         attr = [function.resolve(self._attribute)]
         if path:
             attrs = [tuple(attr + path)]
         else:
             attrs = attr
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args, resource_name), attrs)
Beispiel #10
0
 def dep_attrs(self, resource_name):
     if self._resource().name == resource_name:
         path = function.resolve(self._path_components)
         attr = [function.resolve(self._attribute)]
         if path:
             attrs = [tuple(attr + path)]
         else:
             attrs = attr
     else:
         attrs = []
     return itertools.chain(function.dep_attrs(self.args, resource_name),
                            attrs)
Beispiel #11
0
    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))
Beispiel #12
0
    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)
Beispiel #13
0
    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)