Beispiel #1
0
def is_prompt_toolkit_3():
    from prompt_toolkit import __version__ as ptk_version

    return ptk_version.startswith("3.")
Beispiel #2
0
    List,
    Dict,
    Enum,
    Instance,
    Any,
)
from traitlets.config import SingletonConfigurable

from .completer import ZMQCompleter
from .zmqhistory import ZMQHistoryManager
from . import __version__

# Discriminate version3 for asyncio
from prompt_toolkit import __version__ as ptk_version

PTK3 = ptk_version.startswith('3.')

if not PTK3:
    # use_ayncio_event_loop obsolete in PKT3
    from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop

from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.document import Document
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
from prompt_toolkit.filters import (
    Condition,
    has_focus,
    has_selection,
    vi_insert_mode,
    emacs_insert_mode,
    is_done,
Beispiel #3
0
""" Command line interface using prompt_toolkit. """

import logging
from asyncio import get_event_loop
from prompt_toolkit import __version__ as ptk_version

# Check version of prompt toolkit:
if not ptk_version.startswith("3."):
    print(
        "We require prompt toolkit version 3.x, we currently have: {}".format(
            ptk_version))

from prompt_toolkit import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.styles.pygments import style_from_pygments_cls
from prompt_toolkit.lexers import PygmentsLexer
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.containers import HSplit, Window, VSplit
from prompt_toolkit.layout.controls import BufferControl
from prompt_toolkit.layout.controls import FormattedTextControl
from prompt_toolkit.layout.margins import NumberedMargin, ScrollbarMargin
from prompt_toolkit.layout.margins import Margin
from prompt_toolkit.layout.processors import Processor, Transformation
from prompt_toolkit.widgets import Frame

from pygments.lexers import CLexer
from pygments.styles import get_style_by_name

from ... import __version__ as ppci_version
Beispiel #4
0
import sys
from collections import defaultdict
from itertools import zip_longest
from typing import List

import attr
import click
from gi.repository import GLib
from prompt_toolkit import __version__ as ptk_version
from prompt_toolkit import HTML, PromptSession, print_formatted_text
from prompt_toolkit.completion import Completer, Completion, PathCompleter
from prompt_toolkit.document import Document
from prompt_toolkit.patch_stdout import patch_stdout
from pydbus import SessionBus

PTK2 = ptk_version.startswith("2.")

if PTK2:
    from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop

    use_asyncio_event_loop()


class ParseError(Exception):
    pass


class PanctlArgParse(argparse.ArgumentParser):
    def print_usage(self, file=None):
        pass
Beispiel #5
0
import sys
from collections import defaultdict
from itertools import zip_longest
from typing import List

import attr
import click
from gi.repository import GLib
from prompt_toolkit import __version__ as ptk_version
from prompt_toolkit import HTML, PromptSession, print_formatted_text
from prompt_toolkit.completion import Completer, Completion, PathCompleter
from prompt_toolkit.document import Document
from prompt_toolkit.patch_stdout import patch_stdout
from pydbus import SessionBus

PTK2 = ptk_version.startswith('2.')

if PTK2:
    from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
    use_asyncio_event_loop()


class ParseError(Exception):
    pass


class PanctlArgParse(argparse.ArgumentParser):
    def print_usage(self, file=None):
        pass

    def error(self, message):
Beispiel #6
0
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
''' A collection of useful functions '''
import os
import sys

import pykka
from prompt_toolkit import __version__ as ptk_version
from prompt_toolkit.data_structures import Size
from prompt_toolkit.output.base import Output

from glv import Commit, Repo, actors, vcs

from .cache import Cache

if ptk_version.startswith('3.'):
    PTK_VERSION = 3
    # pylint: disable=no-name-in-module,ungrouped-imports
    from prompt_toolkit.output.defaults import create_output
elif ptk_version.startswith('2.'):
    PTK_VERSION = 2
    # pylint: disable=no-name-in-module,ungrouped-imports
    from prompt_toolkit.output.defaults import get_default_output
else:
    print("Unsupported prompt_toolkit version " + ptk_version, file=sys.stderr)
    sys.exit(1)


def parse_args(**kwargs) -> Repo:
    ''' Parse cli arguments to get the `Repo` object '''
    if '--all' in kwargs['<REVISION>']:
Beispiel #7
0
""" Command line interface using prompt_toolkit. """

import logging
from asyncio import get_event_loop
from prompt_toolkit import __version__ as ptk_version

# Check version of prompt toolkit:
if not ptk_version.startswith('3.'):
    print(
        'We require prompt toolkit version 3.x, we currently have: {}'.format(
            ptk_version))

from prompt_toolkit import Application
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.styles.pygments import style_from_pygments_cls
from prompt_toolkit.lexers import PygmentsLexer
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.containers import HSplit, Window, VSplit
from prompt_toolkit.layout.controls import BufferControl
from prompt_toolkit.layout.controls import FormattedTextControl
from prompt_toolkit.layout.margins import NumberedMargin, ScrollbarMargin
from prompt_toolkit.layout.margins import Margin
from prompt_toolkit.layout.processors import Processor, Transformation
from prompt_toolkit.widgets import Frame

from pygments.lexers import CLexer
from pygments.styles import get_style_by_name

from ... import __version__ as ppci_version