예제 #1
0
파일: test_main.py 프로젝트: 0101/pipetools
    def test_chained(self):

        f = ~X.get('item', '').startswith('Hello')

        assert f({'item': 'Hello world'})
        assert not f({'item': 'Goodbye world'})
        assert not f({})
예제 #2
0
    def test_chained(self):

        f = ~X.get('item', '').startswith('Hello')

        assert f({'item': 'Hello world'})
        assert not f({'item': 'Goodbye world'})
        assert not f({})
예제 #3
0
    def test_chained(self):

        f = ~X.get("item", "").startswith("Hello")

        assert f({"item": "Hello world"})
        assert not f({"item": "Goodbye world"})
        assert not f({})
예제 #4
0
 def get(self, request, data):
     bounds = data > maybe | X.get('in_polygon')
     return ((data or {}) > as_kwargs(get_car_position_data)
             | where(X['car'] | self.filter)
             | group_by(X['location'] | (grouping_precision, X, bounds))
             | X.iteritems()
             | foreach({
                 'location': X[1][0]['location'],
                 'cars': X[1] | foreach(X['car']) | self.get_car_data,
             })
             | tuple)
예제 #5
0
 def get(self, request, data):
     bounds = data > maybe | X.get('in_polygon')
     return ((data or {}) > as_kwargs(get_car_position_data)
         | where(X['car'] | self.filter)
         | group_by(X['location'] | (grouping_precision, X, bounds))
         | X.iteritems()
         | foreach({
             'location': X[1][0]['location'],
             'cars': X[1] | foreach(X['car']) | self.get_car_data,
           })
         | tuple)