<commit_before>from pygame.surface import Surface
from pygame.mixer import Channel
from lib.globals import SCREEN_SIZE
from lib.custom_data.character_data import *
from lib.custom_data.settings_data import SettingsData
from exceptions import NotImplementedError
from __builtin__ import False


class State(object):
    """An abstract class that all Game States are derived from.

    A 'State' represents one of the many different screens that make up
    the game: Title Screen, Settings Screen, Battle Screen, etc.
    At its core, game processing consists of running the main game loop
    and updating the appropriate State on each iteration.
    Each State is essentially its own program with its own unique
    methods and attributes. Any data that needs to be shared between
    States is stored within a single StatePass object, which all States
    will reference.

    Attributes:
        state_manager: The GameStateManager object that manages and
            updates this State.
        state_pass: The StatePass object that stores data to pass onto
            other States.
        state_surface: All graphics in this State will be drawn
             onto this PyGame Surface.
        exact_offset: A tuple of floats that represent the coordinates
            of the upper-left corner of state_surface relative to the
            screen.
            However, graphics can only be drawn in whole pixels,
            so the coordinates will first need to be rounded and
            converted to integer values. Use the screen_offset() method
            to obtain drawing-friendly coordinates.
        is_accepting_input: A Boolean indicating whether this State is
            currently responding to player input.
    """
    def __init__(self, state_manager, state_pass):
        """Declare and initialize instance variables.

        state_manager       The GameStateManager object that manages
                            and updates this State.
        state_pass          The StatePass object that stores info to
                            pass onto other States.
        """
        self.state_pass = state_pass
        self.state_manager = state_manager
        self.state_surface = Surface(SCREEN_SIZE)
        self.exact_offset = (0.0, 0.0)
        self.is_accepting_input = True

    def load_state(self):
        """Use the information passed on from the parameters to set up
        the Game State and prepare it for use.
        """
        raise NotImplementedError

    def reset_state(self):
        """Reset the State to how it would look if it were loaded for
        the first time.
        """
        raise NotImplementedError

    def animate_intro(self, time):
        """Update the State's intro animation. This can be a fade-in,
        slide-in, or what-have-you.

        Keyword arguments:<commit_msg>Use a converted Surface for state_surface<commit_after>from pygame.surface import Surface
from pygame.mixer import Channel
from lib.globals import SCREEN_SIZE
from lib.custom_data.character_data import *
from lib.custom_data.settings_data import SettingsData
from exceptions import NotImplementedError
from __builtin__ import False


class State(object):
    """An abstract class that all Game States are derived from.

    A 'State' represents one of the many different screens that make up
    the game: Title Screen, Settings Screen, Battle Screen, etc.
    At its core, game processing consists of running the main game loop
    and updating the appropriate State on each iteration.
    Each State is essentially its own program with its own unique
    methods and attributes. Any data that needs to be shared between
    States is stored within a single StatePass object, which all States
    will reference.

    Attributes:
        state_manager: The GameStateManager object that manages and
            updates this State.
        state_pass: The StatePass object that stores data to pass onto
            other States.
        state_surface: All graphics in this State will be drawn
             onto this PyGame Surface.
        exact_offset: A tuple of floats that represent the coordinates
            of the upper-left corner of state_surface relative to the
            screen.
            However, graphics can only be drawn in whole pixels,
            so the coordinates will first need to be rounded and
            converted to integer values. Use the screen_offset() method
            to obtain drawing-friendly coordinates.
        is_accepting_input: A Boolean indicating whether this State is
            currently responding to player input.
    """
    def __init__(self, state_manager, state_pass):
        """Declare and initialize instance variables.

        state_manager       The GameStateManager object that manages
                            and updates this State.
        state_pass          The StatePass object that stores info to
                            pass onto other States.
        """
        self.state_pass = state_pass
        self.state_manager = state_manager
        self.state_surface = Surface(SCREEN_SIZE).convert()
        self.state_surface.set_alpha(255)
        self.exact_offset = (0.0, 0.0)
        self.is_accepting_input = True

    def load_state(self):
        """Use the information passed on from the parameters to set up
        the Game State and prepare it for use.
        """
        raise NotImplementedError

    def reset_state(self):
        """Reset the State to how it would look if it were loaded for
        the first time.
        """
        raise NotImplementedError

    def animate_intro(self, time):
        """Update the State's intro animation. This can be a fade-in,
        slide-in, or what-have-you.

        Keyword arguments:
{'fraction_non_alphanumeric': 0.04283732223378425, 'fraction_numerical': 0.0019077349982656955, 'mean_word_length': 2.4532934131736526, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3709377', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1331, 'n_words': 639}