Ejemplo n.º 1
0
 def masked_use(self, data):
     c = ChunkedDataDict()
     neg, pos = split_negations(data)
     if neg or pos:
         c.add_bare_global(neg, pos)
     c.update_from_stream(
         chain_from_iterable(self.pkg_use_mask.itervalues()))
     c.freeze()
     return c
Ejemplo n.º 2
0
    def render_prepends(self, manager, key, type_name, flatten=True):
        results = []
        # keep in mind that the sequence we get is a top -> bottom walk of the config
        # as such for this operation we have to reverse it when building the content-
        # specifically, reverse the ordering, but not the content of each item.
        data = []
        for content in self.render_vals(manager, key, type_name):
            data.append(content)
            if content[1]:
                break

        for prepend, this_content, append in reversed(data):
            if this_content:
                results = [this_content]
            if prepend:
                results = [prepend] + results
            if append:
                results += [append]

        if flatten:
            results = iterables.chain_from_iterable(results)
        return list(results)
Ejemplo n.º 3
0
 def enabled_operations(self):
     s = set(chain_from_iterable(tree.operations.enabled_operations
         for tree in self.repo.trees))
     return frozenset(self._apply_overrides(s))
Ejemplo n.º 4
0
 def raw_operations(self):
     return frozenset(chain_from_iterable(tree.operations.raw_operations
         for tree in self.repo.trees))
Ejemplo n.º 5
0
 def pkg_use(self, data):
     c = ChunkedDataDict()
     c.update_from_stream(
         chain_from_iterable(self._parse_package_use(data).itervalues()))
     c.freeze()
     return c