示例#1
0
def test_reduce_right_exception(case, exception):
    raised = False

    try:
        _.reduce_right(*case)
    except exception:
        raised = True

    assert raised
示例#2
0
    def ingredients(x, _path):
        with open(_path + '/' + x, 'r') as f:

            xoxo = _.reduce_right(json.load(f), coco_mixer)
            print(xoxo)

            if len(xoxo) > 0 and xoxo[0] != None:
                with open(str(xoxo[0]['output']), 'w') as makefile:
                    for item in xoxo:
                        object_id = str(item['darkchocolate'][0])
                        center_x = str(item['darkchocolate'][1])
                        center_y = str(item['darkchocolate'][2])
                        width = str(item['darkchocolate'][3])
                        height = str(item['darkchocolate'][4])

                        spaces = object_id + " " + center_x + " " + center_y + " " + width + " " + height

                        makefile.write('%s\n' % spaces)
示例#3
0
def det():
    if len(data) == 1:
        return data
    else:
        return [1] + _.reduce_right(data, fn, init)['result']
示例#4
0
 def reduce_right(self, iteratee=None, initial=None):
     """Reduce reversed :meth:`all` using `iteratee`."""
     return pyd.reduce_right(self.all(), iteratee, initial)
示例#5
0
def test_reduce_right(case, expected):
    assert _.reduce_right(*case) == expected
示例#6
0
 def reduce_right(self, callback=None, initial=None):
     """Reduce reversed :meth:`all` using `callback`."""
     return pyd.reduce_right(self.all(), callback, initial)