# Path: pgzero/runner.py
# def prepare_mod(mod):
#     """Prepare a module to run as a Pygame Zero program.
# 
#     mod is a loaded module object.
# 
#     This sets up things like screen, loaders and builtins, which need to be
#     set before the module globals are run.
# 
#     """
#     loaders.set_root(mod.__file__)
#     PGZeroGame.show_default_icon()
#     pygame.display.set_mode((100, 100), DISPLAY_FLAGS)
#     mod.__dict__.update(builtins.__dict__)
# 
# def run_mod(mod):
#     """Run the module."""
#     PGZeroGame(mod).run()


import sys
import os
from pgzero.runner import prepare_mod, run_mod
"""Runner system for Pygame Zero.

By importing this module, the __main__ module is populated with the builtins
provided by Pygame Zero.

When pgzrun.go() is called, the __main__ module is run as a Pygame Zero
script (we enter the game loop, calling draw() and update() etc as defined in
__main__).

"""


mod = sys.modules['__main__']
if not getattr(sys, '_pgzrun', None):
    if not getattr(mod, '__file__', None):
        raise ImportError(
            "You are running from an interactive interpreter.\n"
            "'import pgzrun' only works when you are running a Python file."
        )

# Path: pgzero/runner.py
# def prepare_mod(mod):
#     """Prepare a module to run as a Pygame Zero program.
# 
#     mod is a loaded module object.
# 
#     This sets up things like screen, loaders and builtins, which need to be
#     set before the module globals are run.
# 
#     """
#     loaders.set_root(mod.__file__)
#     PGZeroGame.show_default_icon()
#     pygame.display.set_mode((100, 100), DISPLAY_FLAGS)
#     mod.__dict__.update(builtins.__dict__)
# 
# def run_mod(mod):
#     """Run the module."""
#     PGZeroGame(mod).run()


# Path: pgzrun.py
import sys
import os
from pgzero.runner import prepare_mod, run_mod

"""Runner system for Pygame Zero.

By importing this module, the __main__ module is populated with the builtins
provided by Pygame Zero.

When pgzrun.go() is called, the __main__ module is run as a Pygame Zero
script (we enter the game loop, calling draw() and update() etc as defined in
__main__).

"""


mod = sys.modules['__main__']
if not getattr(sys, '_pgzrun', None):
    if not getattr(mod, '__file__', None):
        raise ImportError(
            "You are running from an interactive interpreter.\n"
            "'import pgzrun' only works when you are running a Python file."
        )

    prepare_mod(mod)