How to use the bpython.translations.init function in bpython

To help you get started, we’ve selected a few bpython 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 bpython / bpython / bpython / curtsies.py View on Github external
def main(args=None, locals_=None, banner=None, welcome_message=None):
    """
    banner is displayed directly after the version information.
    welcome_message is passed on to Repl and displayed in the statusbar.
    """
    translations.init()

    config, options, exec_args = bpargs.parse(
        args,
        (
            "curtsies options",
            None,
            [
                Option(
                    "--log",
                    "-L",
                    action="count",
                    help=_("log debug messages to bpython.log"),
                ),
                Option(
                    "--paste",
                    "-p",
github bpython / bpython / bpython / simplerepl.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()
    while importcompletion.find_coroutine():
        pass
    with SimpleRepl() as r:
        r.width = 50
        r.height = 10
        while True:
            r.print_output()
            r.get_input()
github bpython / bpython / bpython / curtsiesfrontend / repl.py View on Github external
import re
import logging
import code
import threading
import greenlet
import subprocess
import tempfile

from bpython.autocomplete import Autocomplete, SIMPLE
from bpython.repl import Repl as BpythonRepl
from bpython.config import Struct, loadini, default_config_path
from bpython.formatter import BPythonFormatter
from pygments import format
from bpython import importcompletion
from bpython import translations
translations.init()
from bpython.translations import _
from bpython._py3compat import py3

from curtsies.fsarray import FSArray
from curtsies.fmtstr import fmtstr, FmtStr
from curtsies.bpythonparse import parse as bpythonparse
from curtsies.bpythonparse import func_for_letter, color_for_letter

from bpython.curtsiesfrontend.manual_readline import char_sequences as rl_char_sequences
from bpython.curtsiesfrontend.manual_readline import get_updated_char_sequences
from bpython.curtsiesfrontend.interaction import StatusBar
from bpython.curtsiesfrontend import sitefix; sitefix.monkeypatch_quit()
import bpython.curtsiesfrontend.replpainter as paint
import curtsies.events as events
from bpython.curtsiesfrontend.friendly import NotImplementedError
from bpython.curtsiesfrontend.coderunner import CodeRunner, FakeOutput
github bpython / bpython / bpython / cli.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    config, options, exec_args = argsparse(args)

    # Save stdin, stdout and stderr for later restoration
    orig_stdin = sys.stdin
    orig_stdout = sys.stdout
    orig_stderr = sys.stderr

    try:
        (exit_value, output) = curses_wrapper(
            main_curses,
            exec_args,
            config,
            options.interactive,
            locals_,
            banner=banner,
github bpython / bpython / bpython / urwid.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    # TODO: maybe support displays other than raw_display?
    config, options, exec_args = bpargs.parse(
        args,
        (
            "Urwid options",
            None,
            [
                Option(
                    "--twisted",
                    "-T",
                    action="store_true",
                    help=_("Run twisted reactor."),
                ),
                Option(
                    "--reactor",
github ivanov / bipython / bipython / __init__.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    import argparse
    parser = argparse.ArgumentParser(
            description='the boldly indiscriminate Python interpreter')
    parser.add_argument( '-v','--version', action='version',
            version='%(prog)s ' + version)
    parser.parse_known_args()

    # ok, it's not nice, i'm hiding all of these params, but LTS.
    #
    # TODO: maybe support displays other than raw_display?
    config, options, exec_args = bpargs.parse(args, (
            'Urwid options', None, [
                Option('--twisted', '-T', action='store_true',
                       help=_('Run twisted reactor.')),
                Option('--reactor', '-r',
github bpython / bpython / bpython / gtk_.py View on Github external
def main(args=None):
    translations.init()

    gtk_options = (_('gtk-specific options'),
                   _("Options specific to bpython's Gtk+ front end"),
                   [optparse.Option('--socket-id', dest='socket_id',
                                    type='int', help=_('Embed bpython'))])
    config, options, exec_args = bpython.args.parse(args, gtk_options,
                                                    True)

    interpreter = repl.Interpreter(None, getpreferredencoding())
    repl_widget = ReplWidget(interpreter, config)
    repl_widget.connect('exit-event', gtk.main_quit)

    gobject.idle_add(init_import_completion)

    if not exec_args:
        sys.path.insert(0, '')