Пример #1
0
    def get_all(self):
        """
        Generate all the tiles in the store with their data.

        :rtype: iterator

        """
        return map(self.get_one, ifilter(None, self.list()))
Пример #2
0
    def __len__(self):
        """
        Returns the total number of tiles in the store.

        :rtype: int

        """
        return reduce(lambda x, _: x + 1, ifilter(None, self.list()), 0)
Пример #3
0
    def get_bounding_pyramid(self):
        """
        Returns the bounding pyramid that encloses all tiles in the store.

        :rtype: :class:`BoundingPyramid`

        """
        return reduce(BoundingPyramid.add,
                      map(attrgetter("tilecoord"), ifilter(None, self.list())),
                      BoundingPyramid())
Пример #4
0
    def put(self, tiles):
        """
        Store ``tiles`` in the store.

        :param tiles: Tilestream
        :type tiles: iterator

        :rtype: iterator

        """
        return map(self.put_one, ifilter(None, tiles))
Пример #5
0
    def get(self, tiles):
        """
        Add data to each of ``tiles``.

        :param tiles: Tilestream
        :type tiles: iterator

        :rtype: iterator

        """
        return map(self.get_one, ifilter(None, tiles))
Пример #6
0
    def delete(self, tiles):
        """
        Delete ``tiles`` from the store.

        :param tiles: Input tilestream
        :type tiles: iterable

        :rtype: iterator

        """
        return map(self.delete_one, ifilter(None, tiles))
Пример #7
0
def partition(pred, iterable):
    'Use a predicate to partition entries into false entries and true entries'
    # partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
    t1, t2 = it.tee(iterable)
    return it.filterfalse(pred, t1), ifilter(pred, t2)
Пример #8
0
def partition(pred, iterable):
    'Use a predicate to partition entries into false entries and true entries'
    # partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
    t1, t2 = it.tee(iterable)
    return it.filterfalse(pred, t1), ifilter(pred, t2)