Esempio n. 1
0
def fix_ipython_autocomplete(enable=True):
    """Change autocomplete behavior for IPython > 6.x

    Parameter
    ---------
    enable : bool (default True)
        Is use the trick.

    Notes
    -----
    Since IPython > 6.x the ``jedi`` package is using for autocomplete by default.
    But in some cases, the autocomplete doesn't work correctly wrong (see e.g.
    `here <https://github.com/ipython/ipython/issues/11653>`_).

    To set the correct behaviour we should use in IPython environment::

        %config Completer.use_jedi = False

    or add to IPython config (``<HOME>\.ipython\profile_default\ipython_config.py``)::

        c.Completer.use_jedi = False
    """

    try:
        __IPYTHON__
    except NameError:
        pass
    else:
        from IPython import __version__

        major = int(__version__.split(".")[0])
        if major >= 6:
            from IPython import get_ipython

            get_ipython().Completer.use_jedi = not enable
Esempio n. 2
0
# IPython must be >= 0.13
try:
    from IPython.terminal.embed import InteractiveShellEmbed
    from IPython.config.loader import Config
    from IPython import __version__ as ipython_version
    cfg = Config()
    cfg.PromptManager.in_template = "MPIP [\#]: "
    cfg.InteractiveShellEmbed.autocall = 2
    ipshell = InteractiveShellEmbed(config=cfg,
                                    banner1=banner,
                                    user_ns=locals())
    _session._ipshell = ipshell
#    ipshell.set_hook('complete_command', _opts_completer, re_key = '.*')
except ImportError:
    if ipython_version.split('.')[1] < 13:
        mylog.error('Ipython >13 required.')
        sys.exit(1)

# Initialize all the stadard tasks
run_bbs = mpip.Run_bbs(_session)
run_cmd = mpip.Run_cmd(_session)
run_casa = mpip.Run_casa(_session)
run_awimager = mpip.Run_awimager(_session)
run_ndppp = mpip.Run_ndppp(_session)
clcmd = mpip.Clcmd(_session)
jobs = mpip.Jobs(_session)
movesb = mpip.Movesb(_session)

ipshell()
Esempio n. 3
0

# IPython must be >= 0.13
try:
    from IPython.terminal.embed import InteractiveShellEmbed
    from IPython.config.loader import Config
    from IPython import __version__ as ipython_version
    cfg = Config()
    cfg.PromptManager.in_template = "MPIP [\#]: "
    cfg.InteractiveShellEmbed.autocall = 2
    ipshell = InteractiveShellEmbed(config=cfg, banner1=banner,
                                    user_ns=locals())
    _session._ipshell = ipshell
#    ipshell.set_hook('complete_command', _opts_completer, re_key = '.*')
except ImportError:
    if ipython_version.split('.')[1] < 13: 
       mylog.error('Ipython >13 required.')
       sys.exit(1)

# Initialize all the stadard tasks
run_bbs = mpip.Run_bbs(_session)
run_cmd = mpip.Run_cmd(_session)
run_casa = mpip.Run_casa(_session)
run_awimager = mpip.Run_awimager(_session)
run_ndppp = mpip.Run_ndppp(_session)
clcmd = mpip.Clcmd(_session)
jobs = mpip.Jobs(_session)
movesb = mpip.Movesb(_session)

ipshell()
Esempio n. 4
0
    if config_dict is None:
        config_dict = dict()
    config = get_config(config_dir, args=config_dict)
    return _connect(config, simple_client)


def _connect(config, simple=False):
    if simple:
        return SimpleClient(config)
    return DremioClient(config)


__all__ = [
    "init", "catalog", "catalog_item", "sql", "job_status", "job_results"
]

# https://github.com/ipython/ipython/issues/11653
# autocomplete doesn't work when using jedi so turn it off!
try:
    __IPYTHON__
except NameError:
    pass
else:
    from IPython import __version__

    major = int(__version__.split(".")[0])
    if major >= 6:
        from IPython import get_ipython

        get_ipython().Completer.use_jedi = False
Esempio n. 5
0
    >>> client = init('/my/config/dir')
    """
    config = get_config(config_dir)
    return _connect(config, simple_client)


def _connect(config_dir, simple=False):
    if simple:
        return SimpleClient(config_dir)
    return DremioClient(config_dir)


__all__ = [
    'init', 'catalog', 'catalog_item', 'sql', 'job_status', 'job_results'
]

# https://github.com/ipython/ipython/issues/11653
# autocomplete doesn't work when using jedi so turn it off!
try:
    __IPYTHON__
except NameError:
    pass
else:
    from IPython import __version__

    major = int(__version__.split('.')[0])
    if major >= 6:
        from IPython import get_ipython
        get_ipython().Completer.use_jedi = False