How to use the radian.main.cleanup function in radian

To help you get started, we’ve selected a few radian examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github randy3k / radian / radian / __main__.py View on Github external
cov.save()

        main.cleanup = cleanup

    if "--cprofile" in sys.argv:
        import cProfile
        import pstats
        pr = cProfile.Profile()
        pr.enable()

        def cleanup(x):
            pr.disable()
            ps = pstats.Stats(pr).sort_stats('cumulative')
            ps.print_stats(10)

        main.cleanup = cleanup

    main()
github randy3k / radian / radian / __main__.py View on Github external
from radian import main
import sys

if __name__ == '__main__':
    if "--coverage" in sys.argv:
        import coverage
        cov = coverage.Coverage()
        cov.start()

        def cleanup(x):
            cov.stop()
            cov.save()

        main.cleanup = cleanup

    if "--cprofile" in sys.argv:
        import cProfile
        import pstats
        pr = cProfile.Profile()
        pr.enable()

        def cleanup(x):
            pr.disable()
            ps = pstats.Stats(pr).sort_stats('cumulative')
            ps.print_stats(10)

        main.cleanup = cleanup

    main()
github randy3k / radian / radian / radianapp.py View on Github external
except RuntimeError as e:
            print("Got an error while loading radian profile")
            print(e)

        settings = settings.radian_settings
        settings.load()
        self.session = create_radian_prompt_session(options, settings)

        rchitect.def_callback(name="read_console")(create_read_console(self.session))
        rchitect.def_callback(name="write_console_ex")(
            create_write_console_ex(self.session, settings.stderr_format))

        rutils.load_custom_key_bindings()

        from radian import main
        if main.cleanup:
            rutils.register_cleanup(main.cleanup)

        from . import reticulate
        reticulate.configure()

        # run user on load hooks
        rutils.run_on_load_hooks()

        # print welcome message
        if options.quiet is not True:
            self.session.app.output.write(rchitect.interface.greeting())

        # if sys.platform.startswith("darwin"):
        #     # a workaround to suppress quartz error message
        #     # see https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17734
        #     devnull = os.open(os.devnull, os.O_WRONLY)
github randy3k / radian / radian / radianapp.py View on Github external
print("Got an error while loading radian profile")
            print(e)

        settings = settings.radian_settings
        settings.load()
        self.session = create_radian_prompt_session(options, settings)

        rchitect.def_callback(name="read_console")(create_read_console(self.session))
        rchitect.def_callback(name="write_console_ex")(
            create_write_console_ex(self.session, settings.stderr_format))

        rutils.load_custom_key_bindings()

        from radian import main
        if main.cleanup:
            rutils.register_cleanup(main.cleanup)

        from . import reticulate
        reticulate.configure()

        # run user on load hooks
        rutils.run_on_load_hooks()

        # print welcome message
        if options.quiet is not True:
            self.session.app.output.write(rchitect.interface.greeting())

        # if sys.platform.startswith("darwin"):
        #     # a workaround to suppress quartz error message
        #     # see https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17734
        #     devnull = os.open(os.devnull, os.O_WRONLY)
        #     os.dup2(devnull, 2)