mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
refactoring: move shell to shells.shell to avoid unwanted init (#5556)
Continue #5550 for https://github.com/xonsh/xonsh/issues/5538 --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
This commit is contained in:
parent
7ffce23d29
commit
1d7cc00962
26 changed files with 50 additions and 49 deletions
|
@ -37,7 +37,7 @@ For those of you who want the gritty details.
|
||||||
xonsh.completer
|
xonsh.completer
|
||||||
xonsh.completers
|
xonsh.completers
|
||||||
xonsh.prompt
|
xonsh.prompt
|
||||||
xonsh.shell
|
xonsh.shells
|
||||||
xonsh.base_shell
|
xonsh.base_shell
|
||||||
xonsh.readline_shell
|
xonsh.readline_shell
|
||||||
xonsh.ptk_shell
|
xonsh.ptk_shell
|
||||||
|
|
|
@ -35,7 +35,7 @@ xmain.setup()
|
||||||
spec = importlib.util.find_spec("prompt_toolkit")
|
spec = importlib.util.find_spec("prompt_toolkit")
|
||||||
if spec is not None:
|
if spec is not None:
|
||||||
# hacky runaround to import PTK-specific events
|
# hacky runaround to import PTK-specific events
|
||||||
from xonsh.shell.ptk_shell import events
|
from xonsh.shells.ptk_shell import events
|
||||||
else:
|
else:
|
||||||
from xonsh.events import events
|
from xonsh.events import events
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ readme = {file = ["README.rst"]}
|
||||||
[tool.setuptools]
|
[tool.setuptools]
|
||||||
packages = [
|
packages = [
|
||||||
"xonsh",
|
"xonsh",
|
||||||
|
"xonsh.shells",
|
||||||
|
"xonsh.shells.ptk_shell",
|
||||||
"xonsh.parsers.ply",
|
"xonsh.parsers.ply",
|
||||||
"xonsh.shell",
|
|
||||||
"xonsh.shell.ptk_shell",
|
|
||||||
"xonsh.procs",
|
"xonsh.procs",
|
||||||
"xonsh.platform",
|
"xonsh.platform",
|
||||||
"xonsh.parsers",
|
"xonsh.parsers",
|
||||||
|
@ -243,11 +243,11 @@ convention = "numpy"
|
||||||
"xonsh/style_tools.py" = ["F821"]
|
"xonsh/style_tools.py" = ["F821"]
|
||||||
"xonsh/xoreutils/*.py" = ["E722"]
|
"xonsh/xoreutils/*.py" = ["E722"]
|
||||||
"xonsh/completers/python.py" = ["E722"]
|
"xonsh/completers/python.py" = ["E722"]
|
||||||
|
"xonsh/shells/ptk_shell/__init__.py" = ["E731"]
|
||||||
|
"xonsh/shells/readline_shell.py" = ["F401"]
|
||||||
"xonsh/parsers/ast.py" = ["F401"]
|
"xonsh/parsers/ast.py" = ["F401"]
|
||||||
"xonsh/shell/ptk_shell/__init__.py" = ["E731"]
|
|
||||||
"xonsh/shell/readline_shell.py" = ["F401"]
|
|
||||||
"xonsh/commands_cache.py" = ["F841"]
|
"xonsh/commands_cache.py" = ["F841"]
|
||||||
"xonsh/shell/ptk_shell/key_bindings.py" = ["F841"]
|
"xonsh/shells/ptk_shell/key_bindings.py" = ["F841"]
|
||||||
"xonsh/tools.py" = [
|
"xonsh/tools.py" = [
|
||||||
"E731",
|
"E731",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
"""(A down payment on) Testing for ``xonsh.shell.base_shell.BaseShell`` and associated classes"""
|
"""(A down payment on) Testing for ``xonsh.shells.base_shell.BaseShell`` and associated classes"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xonsh.shell import transform_command
|
from xonsh.shells.base_shell import BaseShell
|
||||||
from xonsh.shell.base_shell import BaseShell
|
from xonsh.shells.shell import transform_command
|
||||||
|
|
||||||
|
|
||||||
def test_pwd_tracks_cwd(xession, xonsh_execer, tmpdir_factory, monkeypatch):
|
def test_pwd_tracks_cwd(xession, xonsh_execer, tmpdir_factory, monkeypatch):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from prompt_toolkit.document import Document
|
||||||
from xonsh.aliases import Aliases
|
from xonsh.aliases import Aliases
|
||||||
from xonsh.completer import Completer
|
from xonsh.completer import Completer
|
||||||
from xonsh.completers.tools import RichCompletion
|
from xonsh.completers.tools import RichCompletion
|
||||||
from xonsh.shell.ptk_shell.completer import PromptToolkitCompleter
|
from xonsh.shells.ptk_shell.completer import PromptToolkitCompleter
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
@ -9,7 +9,7 @@ except ImportError:
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def history_obj():
|
def history_obj():
|
||||||
"""Instantiate `PromptToolkitHistory` and append a line string"""
|
"""Instantiate `PromptToolkitHistory` and append a line string"""
|
||||||
from xonsh.shell.ptk_shell.history import PromptToolkitHistory
|
from xonsh.shells.ptk_shell.history import PromptToolkitHistory
|
||||||
|
|
||||||
hist = PromptToolkitHistory(load_prev=False)
|
hist = PromptToolkitHistory(load_prev=False)
|
||||||
hist.append_string("line10")
|
hist.append_string("line10")
|
||||||
|
|
|
@ -17,7 +17,7 @@ Context = namedtuple("Context", ["indent", "buffer", "accept", "cli", "cr"])
|
||||||
def ctx(xession):
|
def ctx(xession):
|
||||||
"""Context in which the ptk multiline functionality will be tested."""
|
"""Context in which the ptk multiline functionality will be tested."""
|
||||||
xession.env["INDENT"] = " "
|
xession.env["INDENT"] = " "
|
||||||
from xonsh.shell.ptk_shell.key_bindings import carriage_return
|
from xonsh.shells.ptk_shell.key_bindings import carriage_return
|
||||||
|
|
||||||
ptk_buffer = Buffer()
|
ptk_buffer = Buffer()
|
||||||
ptk_buffer.accept_action = MagicMock(name="accept")
|
ptk_buffer.accept_action = MagicMock(name="accept")
|
||||||
|
@ -53,14 +53,14 @@ def test_dedent(ctx):
|
||||||
def test_nodedent(ctx):
|
def test_nodedent(ctx):
|
||||||
"""don't dedent if first line of ctx.buffer"""
|
"""don't dedent if first line of ctx.buffer"""
|
||||||
mock = MagicMock(return_value=True)
|
mock = MagicMock(return_value=True)
|
||||||
with patch("xonsh.shell.ptk_shell.key_bindings.can_compile", mock):
|
with patch("xonsh.shells.ptk_shell.key_bindings.can_compile", mock):
|
||||||
document = Document("pass")
|
document = Document("pass")
|
||||||
ctx.buffer.set_document(document)
|
ctx.buffer.set_document(document)
|
||||||
ctx.cr(ctx.buffer, ctx.cli)
|
ctx.cr(ctx.buffer, ctx.cli)
|
||||||
assert ctx.accept.mock_calls is not None
|
assert ctx.accept.mock_calls is not None
|
||||||
|
|
||||||
mock = MagicMock(return_value=True)
|
mock = MagicMock(return_value=True)
|
||||||
with patch("xonsh.shell.ptk_shell.key_bindings.can_compile", mock):
|
with patch("xonsh.shells.ptk_shell.key_bindings.can_compile", mock):
|
||||||
document = Document(ctx.indent + "pass")
|
document = Document(ctx.indent + "pass")
|
||||||
ctx.buffer.set_document(document)
|
ctx.buffer.set_document(document)
|
||||||
ctx.cr(ctx.buffer, ctx.cli)
|
ctx.cr(ctx.buffer, ctx.cli)
|
||||||
|
@ -76,7 +76,7 @@ def test_continuation_line(ctx):
|
||||||
|
|
||||||
def test_trailing_slash(ctx):
|
def test_trailing_slash(ctx):
|
||||||
mock = MagicMock(return_value=True)
|
mock = MagicMock(return_value=True)
|
||||||
with patch("xonsh.shell.ptk_shell.key_bindings.can_compile", mock):
|
with patch("xonsh.shells.ptk_shell.key_bindings.can_compile", mock):
|
||||||
document = Document("this line will \\")
|
document = Document("this line will \\")
|
||||||
ctx.buffer.set_document(document)
|
ctx.buffer.set_document(document)
|
||||||
ctx.cr(ctx.buffer, ctx.cli)
|
ctx.cr(ctx.buffer, ctx.cli)
|
||||||
|
@ -88,7 +88,7 @@ def test_trailing_slash(ctx):
|
||||||
|
|
||||||
def test_cant_compile_newline(ctx):
|
def test_cant_compile_newline(ctx):
|
||||||
mock = MagicMock(return_value=False)
|
mock = MagicMock(return_value=False)
|
||||||
with patch("xonsh.shell.ptk_shell.key_bindings.can_compile", mock):
|
with patch("xonsh.shells.ptk_shell.key_bindings.can_compile", mock):
|
||||||
document = Document("for i in (1, 2, ")
|
document = Document("for i in (1, 2, ")
|
||||||
ctx.buffer.set_document(document)
|
ctx.buffer.set_document(document)
|
||||||
ctx.cr(ctx.buffer, ctx.cli)
|
ctx.cr(ctx.buffer, ctx.cli)
|
||||||
|
@ -97,7 +97,7 @@ def test_cant_compile_newline(ctx):
|
||||||
|
|
||||||
def test_can_compile_and_executes(ctx):
|
def test_can_compile_and_executes(ctx):
|
||||||
mock = MagicMock(return_value=True)
|
mock = MagicMock(return_value=True)
|
||||||
with patch("xonsh.shell.ptk_shell.key_bindings.can_compile", mock):
|
with patch("xonsh.shells.ptk_shell.key_bindings.can_compile", mock):
|
||||||
document = Document("ls")
|
document = Document("ls")
|
||||||
ctx.buffer.set_document(document)
|
ctx.buffer.set_document(document)
|
||||||
ctx.cr(ctx.buffer, ctx.cli)
|
ctx.cr(ctx.buffer, ctx.cli)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import pyte
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xonsh.platform import minimum_required_ptk_version
|
from xonsh.platform import minimum_required_ptk_version
|
||||||
from xonsh.shell import Shell
|
from xonsh.shells.ptk_shell import tokenize_ansi
|
||||||
from xonsh.shell.ptk_shell import tokenize_ansi
|
from xonsh.shells.shell import Shell
|
||||||
|
|
||||||
# verify error if ptk not installed or below min
|
# verify error if ptk not installed or below min
|
||||||
|
|
||||||
|
@ -51,13 +51,13 @@ def test_prompt_toolkit_version_checks(
|
||||||
return ptk_ver is not None
|
return ptk_ver is not None
|
||||||
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"xonsh.shell.warnings.warn", mock_warning
|
"xonsh.shells.shell.warnings.warn", mock_warning
|
||||||
) # hardwon: patch the caller!
|
) # hardwon: patch the caller!
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"xonsh.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
"xonsh.shells.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||||
) # have to patch both callers
|
) # have to patch both callers
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"xonsh.platform.ptk_above_min_supported", mock_ptk_above_min_supported
|
"xonsh.shells.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||||
)
|
)
|
||||||
monkeypatch.setattr("xonsh.platform.has_prompt_toolkit", mock_has_prompt_toolkit)
|
monkeypatch.setattr("xonsh.platform.has_prompt_toolkit", mock_has_prompt_toolkit)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xonsh.completers.tools import RichCompletion
|
from xonsh.completers.tools import RichCompletion
|
||||||
from xonsh.shell.readline_shell import _render_completions
|
from xonsh.shells.readline_shell import _render_completions
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
"""Testing for ``xonsh.shell.Shell``"""
|
"""Testing for ``xonsh.shells.Shell``"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from xonsh.history.dummy import DummyHistory
|
from xonsh.history.dummy import DummyHistory
|
||||||
from xonsh.history.json import JsonHistory
|
from xonsh.history.json import JsonHistory
|
||||||
from xonsh.history.sqlite import SqliteHistory
|
from xonsh.history.sqlite import SqliteHistory
|
||||||
from xonsh.shell import Shell
|
from xonsh.shells.shell import Shell
|
||||||
|
|
||||||
|
|
||||||
def test_shell_with_json_history(xession, xonsh_execer, tmpdir_factory):
|
def test_shell_with_json_history(xession, xonsh_execer, tmpdir_factory):
|
||||||
|
|
|
@ -1535,7 +1535,7 @@ class PromptSetting(Xettings):
|
||||||
"`prompt_toolkit <https://github.com/jonathanslenders/python-prompt-toolkit>`_"
|
"`prompt_toolkit <https://github.com/jonathanslenders/python-prompt-toolkit>`_"
|
||||||
" library installed. To specify which shell should be used, do so in "
|
" library installed. To specify which shell should be used, do so in "
|
||||||
"the run control file. "
|
"the run control file. "
|
||||||
"It also accepts a class type that inherits from ``xonsh.shell.base_shell.BaseShell``",
|
"It also accepts a class type that inherits from ``xonsh.shells.base_shell.BaseShell``",
|
||||||
doc_default="``best``",
|
doc_default="``best``",
|
||||||
)
|
)
|
||||||
SUGGEST_COMMANDS = Var.with_default(
|
SUGGEST_COMMANDS = Var.with_default(
|
||||||
|
|
|
@ -22,7 +22,7 @@ from xonsh.lazyimps import pyghooks, pygments
|
||||||
from xonsh.lib.pretty import pretty
|
from xonsh.lib.pretty import pretty
|
||||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
||||||
from xonsh.procs.jobs import ignore_sigtstp
|
from xonsh.procs.jobs import ignore_sigtstp
|
||||||
from xonsh.shell import Shell
|
from xonsh.shells.shell import Shell
|
||||||
from xonsh.timings import setup_timings
|
from xonsh.timings import setup_timings
|
||||||
from xonsh.tools import (
|
from xonsh.tools import (
|
||||||
display_error_message,
|
display_error_message,
|
||||||
|
|
|
@ -363,7 +363,7 @@ def ptk_shell(xonsh_execer):
|
||||||
from prompt_toolkit.input import create_pipe_input
|
from prompt_toolkit.input import create_pipe_input
|
||||||
from prompt_toolkit.output import DummyOutput
|
from prompt_toolkit.output import DummyOutput
|
||||||
|
|
||||||
from xonsh.shell.ptk_shell import PromptToolkitShell
|
from xonsh.shells.ptk_shell import PromptToolkitShell
|
||||||
|
|
||||||
out = DummyOutput()
|
out = DummyOutput()
|
||||||
with create_pipe_input() as inp:
|
with create_pipe_input() as inp:
|
||||||
|
@ -375,7 +375,7 @@ def ptk_shell(xonsh_execer):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def readline_shell(xonsh_execer, tmpdir, mocker):
|
def readline_shell(xonsh_execer, tmpdir, mocker):
|
||||||
from xonsh.shell.readline_shell import ReadlineShell
|
from xonsh.shells.readline_shell import ReadlineShell
|
||||||
|
|
||||||
inp_path = tmpdir / "in"
|
inp_path = tmpdir / "in"
|
||||||
inp = inp_path.open("w+")
|
inp = inp_path.open("w+")
|
||||||
|
|
|
@ -12,7 +12,7 @@ from collections import defaultdict
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from xonsh.shell.base_shell import BaseShell
|
from xonsh.shells.base_shell import BaseShell
|
||||||
|
|
||||||
VER_MAJOR_MINOR = sys.version_info[:2]
|
VER_MAJOR_MINOR = sys.version_info[:2]
|
||||||
VER_FULL = sys.version_info[:3]
|
VER_FULL = sys.version_info[:3]
|
||||||
|
|
1
xonsh/shells/__init__.py
Normal file
1
xonsh/shells/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
"""The xonsh interactive shells"""
|
|
@ -20,7 +20,7 @@ from xonsh.events import events
|
||||||
from xonsh.lazyimps import pyghooks, pygments
|
from xonsh.lazyimps import pyghooks, pygments
|
||||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
||||||
from xonsh.prompt.base import PromptFormatter, multiline_prompt
|
from xonsh.prompt.base import PromptFormatter, multiline_prompt
|
||||||
from xonsh.shell import transform_command
|
from xonsh.shells.shell import transform_command
|
||||||
from xonsh.tools import (
|
from xonsh.tools import (
|
||||||
DefaultNotGiven,
|
DefaultNotGiven,
|
||||||
XonshError,
|
XonshError,
|
|
@ -1,7 +1,7 @@
|
||||||
"""A dumb shell for when $TERM == 'dumb', which usually happens in emacs."""
|
"""A dumb shell for when $TERM == 'dumb', which usually happens in emacs."""
|
||||||
|
|
||||||
from xonsh.built_ins import XSH
|
from xonsh.built_ins import XSH
|
||||||
from xonsh.shell.readline_shell import ReadlineShell
|
from xonsh.shells.readline_shell import ReadlineShell
|
||||||
|
|
||||||
|
|
||||||
class DumbShell(ReadlineShell):
|
class DumbShell(ReadlineShell):
|
|
@ -29,12 +29,12 @@ from xonsh.events import events
|
||||||
from xonsh.lazyimps import pyghooks, pygments, winutils
|
from xonsh.lazyimps import pyghooks, pygments, winutils
|
||||||
from xonsh.platform import HAS_PYGMENTS, ON_POSIX, ON_WINDOWS
|
from xonsh.platform import HAS_PYGMENTS, ON_POSIX, ON_WINDOWS
|
||||||
from xonsh.pygments_cache import get_all_styles
|
from xonsh.pygments_cache import get_all_styles
|
||||||
from xonsh.shell import transform_command
|
from xonsh.shells.base_shell import BaseShell
|
||||||
from xonsh.shell.base_shell import BaseShell
|
from xonsh.shells.ptk_shell.completer import PromptToolkitCompleter
|
||||||
from xonsh.shell.ptk_shell.completer import PromptToolkitCompleter
|
from xonsh.shells.ptk_shell.formatter import PTKPromptFormatter
|
||||||
from xonsh.shell.ptk_shell.formatter import PTKPromptFormatter
|
from xonsh.shells.ptk_shell.history import PromptToolkitHistory, _cust_history_matches
|
||||||
from xonsh.shell.ptk_shell.history import PromptToolkitHistory, _cust_history_matches
|
from xonsh.shells.ptk_shell.key_bindings import load_xonsh_bindings
|
||||||
from xonsh.shell.ptk_shell.key_bindings import load_xonsh_bindings
|
from xonsh.shells.shell import transform_command
|
||||||
from xonsh.style_tools import DEFAULT_STYLE_DICT, _TokenType, partial_color_tokenize
|
from xonsh.style_tools import DEFAULT_STYLE_DICT, _TokenType, partial_color_tokenize
|
||||||
from xonsh.tools import carriage_return, print_exception, print_warning
|
from xonsh.tools import carriage_return, print_exception, print_warning
|
||||||
|
|
|
@ -4,7 +4,7 @@ import functools
|
||||||
import typing as tp
|
import typing as tp
|
||||||
|
|
||||||
from xonsh.prompt.base import DEFAULT_PROMPT, PromptFormatter
|
from xonsh.prompt.base import DEFAULT_PROMPT, PromptFormatter
|
||||||
from xonsh.shell.ptk_shell.updator import AsyncPrompt, PromptUpdator
|
from xonsh.shells.ptk_shell.updator import AsyncPrompt, PromptUpdator
|
||||||
|
|
||||||
|
|
||||||
class PTKPromptFormatter(PromptFormatter):
|
class PTKPromptFormatter(PromptFormatter):
|
|
@ -19,7 +19,7 @@ from prompt_toolkit.keys import Keys
|
||||||
from xonsh.aliases import xonsh_exit
|
from xonsh.aliases import xonsh_exit
|
||||||
from xonsh.built_ins import XSH
|
from xonsh.built_ins import XSH
|
||||||
from xonsh.platform import ON_WINDOWS
|
from xonsh.platform import ON_WINDOWS
|
||||||
from xonsh.shell import transform_command
|
from xonsh.shells.shell import transform_command
|
||||||
from xonsh.tools import (
|
from xonsh.tools import (
|
||||||
check_for_partial_string,
|
check_for_partial_string,
|
||||||
ends_with_colon_token,
|
ends_with_colon_token,
|
|
@ -119,7 +119,7 @@ class AsyncPrompt:
|
||||||
"""Create a timer to update the prompt. The timing can be configured through env variables.
|
"""Create a timer to update the prompt. The timing can be configured through env variables.
|
||||||
threading.Timer is used to stop calling invalidate frequently.
|
threading.Timer is used to stop calling invalidate frequently.
|
||||||
"""
|
"""
|
||||||
from xonsh.shell.ptk_shell import tokenize_ansi
|
from xonsh.shells.ptk_shell import tokenize_ansi
|
||||||
|
|
||||||
if self.timer:
|
if self.timer:
|
||||||
self.timer.cancel()
|
self.timer.cancel()
|
||||||
|
@ -158,7 +158,7 @@ class PromptUpdator:
|
||||||
"""Handle updating multiple AsyncPrompt instances prompt/rprompt/bottom_toolbar"""
|
"""Handle updating multiple AsyncPrompt instances prompt/rprompt/bottom_toolbar"""
|
||||||
|
|
||||||
def __init__(self, shell):
|
def __init__(self, shell):
|
||||||
from xonsh.shell.ptk_shell import PromptToolkitShell
|
from xonsh.shells.ptk_shell import PromptToolkitShell
|
||||||
|
|
||||||
self.prompts: dict[str, AsyncPrompt] = {}
|
self.prompts: dict[str, AsyncPrompt] = {}
|
||||||
self.shell: PromptToolkitShell = shell
|
self.shell: PromptToolkitShell = shell
|
|
@ -39,7 +39,7 @@ from xonsh.platform import (
|
||||||
os_environ,
|
os_environ,
|
||||||
)
|
)
|
||||||
from xonsh.prompt.base import multiline_prompt
|
from xonsh.prompt.base import multiline_prompt
|
||||||
from xonsh.shell.base_shell import BaseShell
|
from xonsh.shells.base_shell import BaseShell
|
||||||
from xonsh.tools import (
|
from xonsh.tools import (
|
||||||
carriage_return,
|
carriage_return,
|
||||||
columnize,
|
columnize,
|
|
@ -213,13 +213,13 @@ class Shell:
|
||||||
)
|
)
|
||||||
|
|
||||||
if backend == "none":
|
if backend == "none":
|
||||||
from xonsh.shell.base_shell import BaseShell as cls
|
from xonsh.shells.base_shell import BaseShell as cls
|
||||||
elif backend == "prompt_toolkit" or is_stdin_to_interactive:
|
elif backend == "prompt_toolkit" or is_stdin_to_interactive:
|
||||||
from xonsh.shell.ptk_shell import PromptToolkitShell as cls
|
from xonsh.shells.ptk_shell import PromptToolkitShell as cls
|
||||||
elif backend == "readline":
|
elif backend == "readline":
|
||||||
from xonsh.shell.readline_shell import ReadlineShell as cls
|
from xonsh.shells.readline_shell import ReadlineShell as cls
|
||||||
elif backend == "dumb":
|
elif backend == "dumb":
|
||||||
from xonsh.shell.dumb_shell import DumbShell as cls
|
from xonsh.shells.dumb_shell import DumbShell as cls
|
||||||
else:
|
else:
|
||||||
raise XonshError(f"{backend} is not recognized as a shell type")
|
raise XonshError(f"{backend} is not recognized as a shell type")
|
||||||
return cls(**kwargs)
|
return cls(**kwargs)
|
|
@ -1824,7 +1824,7 @@ def to_completion_mode(x):
|
||||||
def is_tok_color_dict(x):
|
def is_tok_color_dict(x):
|
||||||
from pygments.token import _TokenType, string_to_tokentype
|
from pygments.token import _TokenType, string_to_tokentype
|
||||||
|
|
||||||
from xonsh.shell.ptk_shell import _style_from_pygments_dict
|
from xonsh.shells.ptk_shell import _style_from_pygments_dict
|
||||||
|
|
||||||
"""Tests if something is a Token:Style dictionary"""
|
"""Tests if something is a Token:Style dictionary"""
|
||||||
if not isinstance(x, dict):
|
if not isinstance(x, dict):
|
||||||
|
|
Loading…
Add table
Reference in a new issue