Exemplo n.º 1
0
def run_wiki(ui, repo, directory=None, **opts):
    """Start serving Hatta in the provided repository."""

    config = WikiConfig()
    config.set('pages_path', directory or os.path.join(repo.root, 'docs'))
    ui.write('Starting wiki at http://127.0.0.1:8080\n')
    main(config=config)
Exemplo n.º 2
0
def can_configurate():
    try:
        from config import main
        main()
        return True
    except:
        return False
Exemplo n.º 3
0
 def run(cls, script):
     if cls._type is None:
         # call the main on the caller script with the arguments as a python dict
         main(*script.get())
     else:
         # create a new process and passes the arguments on the command line
         subprocess.Popen(cls.exe() + [cls._file] + script.getArgs()).wait()
Exemplo n.º 4
0
def ae_main(app):
    from google.appengine.ext.webapp import util
    import __main__ as mod
    # "if caller is main"
    if sys._getframe(1).f_code.co_filename == mod.__file__:
        mod.main = lambda: util.run_wsgi_app(app)
        mod.main()
Exemplo n.º 5
0
def run_wiki(ui, repo, directory=None, **opts):
    """Start serving Hatta in the provided repository."""

    config = WikiConfig()
    config.set('pages_path', directory or os.path.join(repo.root, 'docs'))
    ui.write('Starting wiki at http://127.0.0.1:8080\n')
    main(config=config)
Exemplo n.º 6
0
def can_run():
    try:
        from __main__ import main
        main()
        return True
    except:
        return False
Exemplo n.º 7
0
def ae_main(app):
    from google.appengine.ext.webapp import util
    import __main__ as mod
    # "if caller is main"
    if sys._getframe(1).f_code.co_filename == mod.__file__:
        mod.main = lambda: util.run_wsgi_app(app)
        mod.main()
Exemplo n.º 8
0
def run ():
    """Run the 'main()' function from the '__main__' module, handling
    some common exceptions in a user-friendly way.
    """
    try:
        import __main__
        __main__.main()
    except (OSError, IOError), err:
        die("%s: %s" % (err.filename, err.strerror))
Exemplo n.º 9
0
 def run(cls, script):
   print("# %s %s started" % (time.strftime('%H:%M:%S'), cls._file))
   if cls._type is None:
     # call the main on the caller script with the arguments as a python dict
     main(*script.get())
   else:
     # create a new process and passes the arguments on the command line
     subprocess.Popen(cls.exe() + [cls._file] + script.getArgs()).wait()
   print("# %s %s finished" % (time.strftime('%H:%M:%S'), cls._file))
Exemplo n.º 10
0
def main(*args):
    if (__name__ != '__main__'):
        from __main__ import main
        # redirect to caller script main
        main(*args)
        return
    # run standalone main code
    print(__name__)
    print(args)
    messagebox.showinfo(message='Business Logic placeholder')
Exemplo n.º 11
0
def usage_gui(usage = None):
  # we already have argument, just proceed with execution
  if(len(sys.argv) > 1):
    # traps help switches: /? -? /h -h /help -help
    if(usage is not None and re.match(r'[\-/](?:\?|h|help)$', sys.argv[1])):
      print(usage)
    elif 'main' in globals():
      main(*sys.argv[1:])
    else:
      print("main() not found")
  else:
    AppTk(usage).mainloop()
Exemplo n.º 12
0
    def run(self):
        frame_rate = 30
        tick_time = int(1.0 / frame_rate * 1000)

        # The game loop starts here.
        keep_going = True
        while keep_going:
            pygame.time.wait(tick_time)

            keep_going = self.handle_events()

        __main__.main()
        self.quit()
Exemplo n.º 13
0
 def test_main(self, mock_add_argument, mock___init__, mock_parse_args):
     mock_add_argument.return_value = _StoreAction()
     mock___init__.return_value = None
     mock_parse_args.return_value = Namespace()
     self.assertEqual(
         __main__.main(),
         None
     )
 def process_args(self, _):
     import __main__
     __main__.main()
Exemplo n.º 15
0
def test_main(mocker: MockFixture):
    mock = mocker.patch.object(main, 'print')
    main.main(['--print'])
    mock.assert_called_once()
Exemplo n.º 16
0
__version__ = "0.2.3"

import __main__ as main

if __name__ == "__main__":
    main.main()  # pragma: no cover
Exemplo n.º 17
0
 def test_main(self):
     self.assertEqual(
         __main__.main(),
         None
     )
 def process_args(self, _):
     import __main__
     __main__.main()
Exemplo n.º 19
0
def main():
	from __main__ import main
	main()
Exemplo n.º 20
0
 def main(self, control):
     __main__.main(control)  # pylint: disable=c-extension-no-member
Exemplo n.º 21
0
def make(*args):
    import __main__ as main
    return main.main()
Exemplo n.º 22
0
# This provides other information on the package along with setup.py

import __main__
import sys
from ocean.classes.OceanHandlerModule import OceanHandler
from ocean.classes.OceanDropletModule import OceanDroplet
from ocean.classes.OceanDependencyModule import OceanDependency

def main():
    OceanHandler(sys.argv)

"""
pyexample.

An example python library.
"""

__version__ = "0.2.0"
__author__ = 'Scott Willett'

if __name__ == "__main__":
    import package.__main__
    __main__.main()
Exemplo n.º 23
0
def test_main():
    with pytest.raises(SystemExit) as e:
        __main__.main()

        assert e.type ==SystemExit
        assert e.value.code == 0
Exemplo n.º 24
0
            with open(file, "w") as f:
                f.write(outfile.getvalue())


def main():
    args = cmd_line_parser.parse_args()

    infile = args.infile
    if args.infile == "-":
        infile = sys.stdin
    doc = NowebReader()
    doc.read(infile)
    out = args.output
    if out == "-":
        out = sys.stdout
    doc.write(args.chunk, out, weave=args.weave, github_syntax=args.github_syntax)


if __name__ == "__main__":
    # Delete the pure-Python version of noweb to prevent cache retrieval
    sys.modules.pop("noweb", None)

    # Use noweb's loader to load itself
    try:
        noweb = ImportHook().load_module("noweb")
    except:
        import __main__ as noweb

    # Exceptions from within noweb should now be linked to the .nw source-file
    noweb.main()
Exemplo n.º 25
0
import __main__

__main__.main()
Exemplo n.º 26
0
def run():
    from __main__ import main
    main()
Exemplo n.º 27
0
    def handle_events(self):

        keep_going = True
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                keep_going = False
            elif self.in_prompt:
                if event.type == pygame.MOUSEBUTTONDOWN:
                    button_pressed = event.dict['button']
                    mouse_pos = event.dict['pos']
                    clicked_obj = self.prompt.check_collisions(mouse_pos)
                    if button_pressed == 1:
                        if isinstance(clicked_obj, Button):
                            if clicked_obj.action is "okay":
                                self.in_prompt = False
                            elif clicked_obj.action is "exit":
                                keep_going = False
                            elif clicked_obj.action is "restart":
                                keep_going = False
                                __main__.main()
                            elif clicked_obj.action is "artifact":
                                self.in_prompt = False
                                self.user.members[0].abilities += [LastHope()]
                            elif clicked_obj.action is "credits":
                                keep_going = False
                                credits = Credits()
                                credits.run()
                elif event.type == pygame.KEYDOWN:
                    key_pressed = event.dict['key'] % 256
                    self.prompt.handle_keydown(key_pressed)

            elif event.type == pygame.KEYDOWN:
                key_pressed = event.dict['key'] % 256
                if key_pressed == pygame.K_a:
                    self.dx += -Campaign.USER_SPEED
                elif key_pressed == pygame.K_d:
                    self.dx += Campaign.USER_SPEED
                elif key_pressed == pygame.K_w:
                    self.dy += -Campaign.USER_SPEED
                elif key_pressed == pygame.K_s:
                    self.dy += Campaign.USER_SPEED
                elif key_pressed == pygame.K_ESCAPE:
                    if self.fullscreen:
                        self.fullscreen = False
                        self.init_screen()
                        self.init_camera()
                    else:
                        self.fullscreen = True
                        self.init_screen()
                        self.init_camera()
            elif event.type == pygame.KEYUP:
                key_released = event.dict['key'] % 256
                if key_released == pygame.K_a:
                    self.dx -= -Campaign.USER_SPEED
                elif key_released == pygame.K_d:
                    self.dx -= Campaign.USER_SPEED
                elif key_released == pygame.K_w:
                    self.dy -= -Campaign.USER_SPEED
                elif key_released == pygame.K_s:
                    self.dy -= Campaign.USER_SPEED
            elif event.type == pygame.MOUSEBUTTONDOWN:
                button_pressed = event.dict['button']

                if button_pressed == 5:
                    self.camera.zoom_out()

                elif button_pressed == 4:
                    self.camera.zoom_in()

        return keep_going
def test_main(mocker, name, called):
    cli = mocker.patch("{{ cookiecutter.package_name }}.cli.cli")
    __main__.main(name)
    assert cli.called is called
Exemplo n.º 29
0
__version__ = "0.1.0"

import __main__ as main

if __name__ == "__main__":
    main.main()