def get(self, key, host=None): """Return resource values without recording a dependency.""" if host is not None: results = [] for root, values in list(self.resources.get(key, {}).items()): if root.component.host is host: results.extend(values) else: results = flatten(list(self.resources.get(key, {}).values())) return results
def test_flatten(): assert [1, 2, 3, 4] == flatten([[1, 2], [3, 4]])