mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
refactoring: deprecation warnings and revert shell moving for backwards compatibility (#5575)
* deprecation warnings * deprecation warnings * deprecation warnings * restore shell * restore shell * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
8e5f460376
commit
0656eb3d3e
13 changed files with 63 additions and 10 deletions
|
@ -4,8 +4,8 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
from xonsh.shell import transform_command
|
||||
from xonsh.shells.base_shell import BaseShell
|
||||
from xonsh.shells.shell import transform_command
|
||||
|
||||
|
||||
def test_pwd_tracks_cwd(xession, xonsh_execer, tmpdir_factory, monkeypatch):
|
||||
|
|
|
@ -6,8 +6,8 @@ import pyte
|
|||
import pytest
|
||||
|
||||
from xonsh.platform import minimum_required_ptk_version
|
||||
from xonsh.shell import Shell
|
||||
from xonsh.shells.ptk_shell import tokenize_ansi
|
||||
from xonsh.shells.shell import Shell
|
||||
|
||||
# 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
|
||||
|
||||
monkeypatch.setattr(
|
||||
"xonsh.shells.shell.warnings.warn", mock_warning
|
||||
"xonsh.shell.warnings.warn", mock_warning
|
||||
) # hardwon: patch the caller!
|
||||
monkeypatch.setattr(
|
||||
"xonsh.shells.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||
"xonsh.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||
) # have to patch both callers
|
||||
monkeypatch.setattr(
|
||||
"xonsh.shells.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||
"xonsh.shell.ptk_above_min_supported", mock_ptk_above_min_supported
|
||||
)
|
||||
monkeypatch.setattr("xonsh.platform.has_prompt_toolkit", mock_has_prompt_toolkit)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import os
|
|||
from xonsh.history.dummy import DummyHistory
|
||||
from xonsh.history.json import JsonHistory
|
||||
from xonsh.history.sqlite import SqliteHistory
|
||||
from xonsh.shells.shell import Shell
|
||||
from xonsh.shell import Shell
|
||||
|
||||
|
||||
def test_shell_with_json_history(xession, xonsh_execer, tmpdir_factory):
|
||||
|
|
11
xonsh/lazyasd.py
Normal file
11
xonsh/lazyasd.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""DEPRECATED: Use `xonsh.lib.lazyasd` instead of `xonsh.lazyasd`."""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Use `xonsh.lib.lazyasd` instead of `xonsh.lazyasd`.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
from xonsh.lib.lazyasd import * # noqa
|
11
xonsh/lazyimps.py
Normal file
11
xonsh/lazyimps.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""DEPRECATED: Use `xonsh.lib.lazyasd` instead of `xonsh.lazyimps`."""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Use `xonsh.lib.lazyimps` instead of `xonsh.lazyimps`.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
from xonsh.lib.lazyimps import * # noqa
|
11
xonsh/lazyjson.py
Normal file
11
xonsh/lazyjson.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""DEPRECATED: Use `xonsh.lib.lazyjson` instead of `xonsh.lazyjson`."""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Use `xonsh.lib.lazyjson` instead of `xonsh.lazyjson`.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
from xonsh.lib.lazyjson import * # noqa
|
9
xonsh/lib/os.py
Normal file
9
xonsh/lib/os.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
"""DEPRECATED: Use `xonsh.lib.lazyasd` instead of `xonsh.lazyasd`."""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Use `xonsh.api.os` instead of `xonsh.lib.os`.", DeprecationWarning, stacklevel=2
|
||||
)
|
||||
|
||||
from xonsh.api.os import * # noqa
|
11
xonsh/lib/subprocess.py
Normal file
11
xonsh/lib/subprocess.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
"""DEPRECATED: Use `xonsh.lib.lazyasd` instead of `xonsh.lazyasd`."""
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Use `xonsh.api.subprocess` instead of `xonsh.lib.subprocess`.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
from xonsh.api.subprocess import * # noqa
|
|
@ -22,7 +22,7 @@ from xonsh.lib.lazyimps import pyghooks, pygments
|
|||
from xonsh.lib.pretty import pretty
|
||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
||||
from xonsh.procs.jobs import ignore_sigtstp
|
||||
from xonsh.shells.shell import Shell
|
||||
from xonsh.shell import Shell
|
||||
from xonsh.timings import setup_timings
|
||||
from xonsh.tools import (
|
||||
display_error_message,
|
||||
|
|
|
@ -20,7 +20,7 @@ from xonsh.events import events
|
|||
from xonsh.lib.lazyimps import pyghooks, pygments
|
||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
||||
from xonsh.prompt.base import PromptFormatter, multiline_prompt
|
||||
from xonsh.shells.shell import transform_command
|
||||
from xonsh.shell import transform_command
|
||||
from xonsh.tools import (
|
||||
DefaultNotGiven,
|
||||
XonshError,
|
||||
|
|
|
@ -29,12 +29,12 @@ from xonsh.events import events
|
|||
from xonsh.lib.lazyimps import pyghooks, pygments, winutils
|
||||
from xonsh.platform import HAS_PYGMENTS, ON_POSIX, ON_WINDOWS
|
||||
from xonsh.pygments_cache import get_all_styles
|
||||
from xonsh.shell import transform_command
|
||||
from xonsh.shells.base_shell import BaseShell
|
||||
from xonsh.shells.ptk_shell.completer import PromptToolkitCompleter
|
||||
from xonsh.shells.ptk_shell.formatter import PTKPromptFormatter
|
||||
from xonsh.shells.ptk_shell.history import PromptToolkitHistory, _cust_history_matches
|
||||
from xonsh.shells.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.tools import carriage_return, print_exception, print_warning
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from prompt_toolkit.keys import Keys
|
|||
from xonsh.aliases import xonsh_exit
|
||||
from xonsh.built_ins import XSH
|
||||
from xonsh.platform import ON_WINDOWS
|
||||
from xonsh.shells.shell import transform_command
|
||||
from xonsh.shell import transform_command
|
||||
from xonsh.tools import (
|
||||
check_for_partial_string,
|
||||
ends_with_colon_token,
|
||||
|
|
Loading…
Add table
Reference in a new issue