# Path: mss/exception.py
# class ScreenShotError(Exception):
#     """ Error handling class. """


import collections
from .exception import ScreenShotError
        # type: () -> int
        """ Convenient accessor to the height size. """
        return self.size.height

    @property
    def pixels(self):
        # type: () -> List[Tuple[int, int, int]]
        """
        :return list: RGB tuples.
        """

        if not self.__pixels:
            rgb_tuples = zip(self.raw[2::4], self.raw[1::4], self.raw[0::4])
            self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width))

        return self.__pixels

    def pixel(self, coord_x, coord_y):
        # type: (int, int) -> Tuple[int, int, int]
        """
        Returns the pixel value at a given position.

        :param int coord_x: The x coordinate.
        :param int coord_y: The y coordinate.
        :return tuple: The pixel value as (R, G, B).
        """

        try:
            return self.pixels[coord_y][coord_x]
        except IndexError:

# Path: mss/exception.py
# class ScreenShotError(Exception):
#     """ Error handling class. """


# Path: mss/screenshot.py
import collections
from .exception import ScreenShotError

        # type: () -> int
        """ Convenient accessor to the height size. """
        return self.size.height

    @property
    def pixels(self):
        # type: () -> List[Tuple[int, int, int]]
        """
        :return list: RGB tuples.
        """

        if not self.__pixels:
            rgb_tuples = zip(self.raw[2::4], self.raw[1::4], self.raw[0::4])
            self.__pixels = list(zip(*[iter(rgb_tuples)] * self.width))

        return self.__pixels

    def pixel(self, coord_x, coord_y):
        # type: (int, int) -> Tuple[int, int, int]
        """
        Returns the pixel value at a given position.

        :param int coord_x: The x coordinate.
        :param int coord_y: The y coordinate.
        :return tuple: The pixel value as (R, G, B).
        """

        try:
            return self.pixels[coord_y][coord_x]
        except IndexError:

            raise ScreenShotError('Pixel location out of range.', locals())