# Path: pyskool/snapshot.py
# def get_snapshot(fname):
#     ext = fname[-4:].lower()
#     if ext not in ('.sna', '.z80', '.szx', '.tzx'):
#         raise SnapshotError("{0}: Unknown file type '{1}'".format(fname, ext[1:]))
#     with open(fname, 'rb') as f:
#         data = bytearray(f.read()) # PY: 'return f.read()' in Python 3
#     if ext == '.sna':
#         ram = data[27:49179]
#     elif ext == '.z80':
#         ram = _read_z80(data)
#     elif ext == '.szx':
#         ram = _read_szx(data)
#     elif ext == '.tzx':
#         ram = _read_tzx(data)
#     if len(ram) != 49152:
#         raise SnapshotError("RAM size is {0}".format(len(ram)))
#     mem = [0] * 16384
#     mem.extend(ram)
#     return mem


from .snapshot import get_snapshot
        return skool_udgs

    def get_logo(self):
        return self.get_box_graphic(self.logo_address)

    def get_score_box_udgs(self):
        udg = Udg(self.snapshot[self.score_box_address], [0] * 8)
        return [[udg] * 8] * 3

    def get_lesson_box_udgs(self):
        udg = Udg(self.lesson_box_attr, [0] * 8)
        return [[udg] * 8] * 3

    def _get_box_udg(self, address, row, col, attr=None):
        if attr is None:
            attr = self.snapshot[address + 8 * row + col]
        start = address + 24 + 64 * row + col
        return Udg(attr, self.snapshot[start:start + 64:8])

    def get_box_graphic(self, address, attr=None):
        udg_array = []
        for row in range(3):
            udg_array.append([self._get_box_udg(address, row, col, attr) for col in range(8)])
        return udg_array

    def add_transparency(self, udg_array, pixel_coords):
        for y, x in pixel_coords:
            udg = udg_array[y // 8][x // 8]
            if udg.mask is None:
                udg.mask = udg.data[:]

# Path: pyskool/snapshot.py
# def get_snapshot(fname):
#     ext = fname[-4:].lower()
#     if ext not in ('.sna', '.z80', '.szx', '.tzx'):
#         raise SnapshotError("{0}: Unknown file type '{1}'".format(fname, ext[1:]))
#     with open(fname, 'rb') as f:
#         data = bytearray(f.read()) # PY: 'return f.read()' in Python 3
#     if ext == '.sna':
#         ram = data[27:49179]
#     elif ext == '.z80':
#         ram = _read_z80(data)
#     elif ext == '.szx':
#         ram = _read_szx(data)
#     elif ext == '.tzx':
#         ram = _read_tzx(data)
#     if len(ram) != 49152:
#         raise SnapshotError("RAM size is {0}".format(len(ram)))
#     mem = [0] * 16384
#     mem.extend(ram)
#     return mem


# Path: pyskool/skoolimage.py
from .snapshot import get_snapshot

        return skool_udgs

    def get_logo(self):
        return self.get_box_graphic(self.logo_address)

    def get_score_box_udgs(self):
        udg = Udg(self.snapshot[self.score_box_address], [0] * 8)
        return [[udg] * 8] * 3

    def get_lesson_box_udgs(self):
        udg = Udg(self.lesson_box_attr, [0] * 8)
        return [[udg] * 8] * 3

    def _get_box_udg(self, address, row, col, attr=None):
        if attr is None:
            attr = self.snapshot[address + 8 * row + col]
        start = address + 24 + 64 * row + col
        return Udg(attr, self.snapshot[start:start + 64:8])

    def get_box_graphic(self, address, attr=None):
        udg_array = []
        for row in range(3):
            udg_array.append([self._get_box_udg(address, row, col, attr) for col in range(8)])
        return udg_array

    def add_transparency(self, udg_array, pixel_coords):
        for y, x in pixel_coords:
            udg = udg_array[y // 8][x // 8]
            if udg.mask is None:
                udg.mask = udg.data[:]

            udg.mask[y % 8] |= (2 ** (7 - (x % 8)))