Exemplo n.º 1
0
def load_enum(struct_name):
    def create_enum_map(enum_map, enumeration, enum_type):
        enum_map[str(enum_type)] = enumeration
        return enum_map

    return functional.multi_reduce(
        create_enum_map, enumerate(read_and_parse_json(struct_name)[0]), {})
Exemplo n.º 2
0
    def testMultiReduce(self):
        def adds_x_and_y(val, x, y):
            return val + x + y

        self.assertEqual(functional.multi_reduce(adds_x_and_y, [(1, 2), (3, 4)], 0), 10)