def test_fold_right(self): input_data = [1, 2, 3] def add(a, b): return a + b result = fold_right(add, input_data) self.assertEqual(result, 6)
def union_all(flat_tables: Iterable["FlatTable"]) -> "FlatTable": """ Return a new flat table containing union of values in an iteration of flat tables. Parameters ---------- flat_tables: Iterable, an iteration of flat tables that will be united. """ return fold_right(_union, flat_tables)
def difference_all(repos: Iterable["FlatTableCollection"]) -> "FlatTableCollection": """ Return each flat table in the first that is not contained in others. Parameters ---------- repos: Iterable An iteration of FlatTableCollections that will be compared with self. """ return fold_right(_difference, repos)
def union_all(repos: Iterable["FlatTableCollection"]) -> "FlatTableCollection": """ Return a new FlatTableCollection containing union of an iteration of FlatTableCollections. Parameters ---------- repos: Iterable, an iteration of FlatTableCollections that will be united. """ return fold_right(_union, repos)
def intersection_all( repos: Iterable["FlatTableCollection"], ) -> "FlatTableCollection": """ Return a new FlatTableCollection containing flat tables in each from an iteration. Parameters ---------- repos: Iterable An iteration of FlatTableCollections that will be joined with self. """ return fold_right(_intersection, repos)
def intersection_all(flat_tables: Iterable["FlatTable"], join_keys: List[str]) -> "FlatTable": """ Return a new flat table containing rows only in each from an iteration. Parameters ---------- flat_tables: Iterable, an iteration of flat tables that will be joined with self. join_keys: List, join keys used to join each in the iteration. """ return fold_right(partial(_intersection, join_keys=join_keys), flat_tables)
def difference_all(flat_tables: Iterable["FlatTable"], join_keys: List[str]) -> "FlatTable": """ Return each values in the first that is not contained in others. Parameters ---------- flat_tables: Iterable An iteration of flat tables that will be compared with self. join_keys: List Join keys used to join each in the iteration. """ return fold_right(partial(_difference, join_keys=join_keys), flat_tables)
def intersect_all( cohort_collections: Iterable["CohortCollection"] ) -> "CohortCollection": return fold_right(_intersection, cohort_collections)
def union_all( cohort_collections: Iterable["CohortCollection"] ) -> "CohortCollection": return fold_right(_union, cohort_collections)