(
            cls, instr, filename=None, do_includes=True, *args, **kwargs)
return new_game
Reads a game from a .p8.png file.

        Args:
          instr: The input stream.
          filename: The filename, if any, for tool messages.
          do_includes: If True, process #include directives.

        Returns:
          A Game containing the game data.

        Raises:
          InvalidP8HeaderError
Reads a game from a .p8.png file.
Reads a game from a . p8 . png file .
def from_file(
            cls, instr, filename=None, do_includes=True, *args, **kwargs):
        """Reads a game from a .p8.png file.

        Args:
          instr: The input stream.
          filename: The filename, if any, for tool messages.
          do_includes: If True, process #include directives.

        Returns:
          A Game containing the game data.

        Raises:
          InvalidP8HeaderError
        """
        data = _get_raw_data_from_p8_file(instr, filename=filename)

        new_game = Game.make_empty_game(filename=filename)
        # Discard empty label until one is found in the file.
        new_game.label = None
        new_game.version = data.version
        for section in data.section_lines:
            if section == 'lua':
                lualines = data.section_lines[section]
                if do_includes:
                    lualines = process_includes(lualines, filename)
                new_game.lua = lua.Lua.from_lines(
                    lualines, version=data.version)
            elif section == 'gfx':
                new_game.gfx = Gfx.from_lines(
                    data.section_lines[section], version=data.version)
                my_map = getattr(new_game, 'map')
                if my_map is not None:
                    my_map._gfx = new_game.gfx
            elif section == 'gff':
                new_game.gff = Gff.from_lines(
                    data.section_lines[section], version=data.version)
            elif section == 'map':
                my_gfx = getattr(new_game, 'gfx')
                new_game.map = Map.from_lines(
                    data.section_lines[section],
                    version=data.version,
                    gfx=my_gfx)
            elif section == 'sfx':
                new_game.sfx = Sfx.from_lines(
                    data.section_lines[section], version=data.version)
            elif section == 'music':
                new_game.music = Music.from_lines(
                    data.section_lines[section], version=data.version)
            elif section == 'label':
                new_game.label = Gfx.from_lines(
                    data.section_lines[section], version=data.version)
            else:
                raise InvalidP8SectionError(section)

        return new_game
def from_file ( cls , instr , filename = None , do_includes = True , * args , * * kwargs ) : data = _get_raw_data_from_p8_file ( instr , filename = filename ) new_game = Game . make_empty_game ( filename = filename ) # Discard empty label until one is found in the file. new_game . label = None new_game . version = data . version for section in data . section_lines : if section == 'lua' : lualines = data . section_lines [ section ] if do_includes : lualines = process_includes ( lualines , filename ) new_game . lua = lua . Lua . from_lines ( lualines , version = data . version ) elif section == 'gfx' : new_game . gfx = Gfx . from_lines ( data . section_lines [ section ] , version = data . version ) my_map = getattr ( new_game , 'map' ) if my_map is not None : my_map . _gfx = new_game . gfx elif section == 'gff' : new_game . gff = Gff . from_lines ( data . section_lines [ section ] , version = data . version ) elif section == 'map' : my_gfx = getattr ( new_game , 'gfx' ) new_game . map = Map . from_lines ( data . section_lines [ section ] , version = data . version , gfx = my_gfx ) elif section == 'sfx' : new_game . sfx = Sfx . from_lines ( data . section_lines [ section ] , version = data . version ) elif section == 'music' : new_game . music = Music . from_lines ( data . section_lines [ section ] , version = data . version ) elif section == 'label' : new_game . label = Gfx . from_lines ( data . section_lines [ section ] , version = data . version ) else : raise InvalidP8SectionError ( section ) return new_game