refactoring: move lazy to lib (#5560)

#5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

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:
Andy Kipp 2024-06-29 12:19:08 +02:00 committed by GitHub
parent 143042aff5
commit 2788ae3308
Failed to generate hash of commit
52 changed files with 59 additions and 59 deletions

View file

@ -14,7 +14,7 @@ from xonsh.history.json import (
_xhj_gc_seconds_to_rmfiles,
)
from xonsh.history.main import HistoryAlias, history_main
from xonsh.lazyjson import LazyJSON
from xonsh.lib.lazyjson import LazyJSON
CMDS = ["ls", "cat hello kitty", "abc", "def", "touch me", "grep from me"]
IGNORE_OPTS = ",".join(["ignoredups", "ignoreerr", "ignorespace"])

View file

@ -1,6 +1,6 @@
"""Tests lazy and self destruictive objects."""
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
#
# LazyObject Tests

View file

@ -2,7 +2,7 @@
from io import StringIO
from xonsh.lazyjson import LazyJSON, LJNode, index, ljdump
from xonsh.lib.lazyjson import LazyJSON, LJNode, index, ljdump
def test_index_int():

View file

@ -328,7 +328,7 @@ def test_colorize_file_symlink(key, file_path, colorizable_files, xs_LS_COLORS):
assert color_key == tar_color_key, "File classified as expected kind, via symlink"
import xonsh.lazyimps
import xonsh.lib.lazyimps
def test_colorize_file_ca(xs_LS_COLORS, monkeypatch):

View file

@ -19,7 +19,7 @@ from xonsh.cli_utils import Annotated, Arg, ArgParserAlias
from xonsh.dirstack import _get_cwd, cd, dirs, popd, pushd
from xonsh.environ import locate_binary, make_args_env
from xonsh.foreign_shells import foreign_shell_data
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers.ast import isexpression
from xonsh.platform import (
IN_APPIMAGE,

View file

@ -16,7 +16,7 @@ from xonsh.color_tools import (
short_to_ints,
warn_deprecated_no_color,
)
from xonsh.lazyasd import LazyDict, lazyobject
from xonsh.lib.lazyasd import LazyDict, lazyobject
from xonsh.platform import HAS_PYGMENTS
from xonsh.tools import FORMATTER

View file

@ -19,8 +19,8 @@ import types
import warnings
from ast import AST
from xonsh.lazyasd import lazyobject
from xonsh.lib.inspectors import Inspector
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import ON_POSIX
from xonsh.tools import (
XonshCalledProcessError,

View file

@ -7,7 +7,7 @@ import sys
from xonsh import __version__ as XONSH_VERSION
from xonsh.built_ins import XSH
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import PYTHON_VERSION_INFO_BYTES
from xonsh.tools import is_writable_file, print_warning

View file

@ -9,7 +9,7 @@ WTFPL http://sam.zoy.org/wtfpl/
import math
import re
from xonsh.lazyasd import LazyObject, lazyobject
from xonsh.lib.lazyasd import LazyObject, lazyobject
from xonsh.tools import print_warning
_NO_COLOR_WARNING_SHOWN = False

View file

@ -14,7 +14,7 @@ import time
import typing as tp
from pathlib import Path
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import ON_POSIX, ON_WINDOWS, pathbasename
from xonsh.tools import executables_in

View file

@ -21,7 +21,7 @@ from xonsh.completers.tools import (
contextual_completer,
get_filter_function,
)
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers.completion_context import CompletionContext
_suffixes = all_suffixes()

View file

@ -3,7 +3,7 @@ import glob
import os
import re
import xonsh.lazyasd as xl
import xonsh.lib.lazyasd as xl
import xonsh.platform as xp
import xonsh.tools as xt
from xonsh.built_ins import XSH

View file

@ -6,7 +6,7 @@ import inspect
import re
import warnings
import xonsh.lazyasd as xl
import xonsh.lib.lazyasd as xl
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.completers.tools import (

View file

@ -10,7 +10,7 @@ from functools import wraps
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers.completion_context import CommandContext, CompletionContext

View file

@ -29,7 +29,7 @@ from xonsh.built_ins import XSH
from xonsh.codecache import run_script_with_cache
from xonsh.dirstack import _get_cwd
from xonsh.events import events
from xonsh.lazyasd import LazyBool, lazyobject
from xonsh.lib.lazyasd import LazyBool, lazyobject
from xonsh.platform import (
BASH_COMPLETIONS_DEFAULT,
DEFAULT_ENCODING,

View file

@ -11,7 +11,7 @@ import tempfile
import warnings
from xonsh.built_ins import XSH
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import ON_CYGWIN, ON_MSYS, ON_WINDOWS
from xonsh.tools import ensure_string, to_bool

View file

@ -5,7 +5,7 @@ import difflib
import itertools
from xonsh.color_tools import COLORS
from xonsh.lazyjson import LazyJSON
from xonsh.lib.lazyjson import LazyJSON
# intern some strings
REPLACE_S = "replace"

View file

@ -19,7 +19,7 @@ except ImportError:
JSONDecodeError = json.decoder.JSONDecodeError # type: ignore
import xonsh.lazyjson as xlj
import xonsh.lib.lazyjson as xlj
import xonsh.tools as xt
import xonsh.xoreutils.uptime as uptime
from xonsh.history.base import History

View file

@ -15,7 +15,7 @@ from importlib.machinery import ModuleSpec
from xonsh.built_ins import XSH
from xonsh.events import events
from xonsh.execer import Execer
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import ON_WINDOWS
from xonsh.tools import print_warning

View file

@ -15,8 +15,8 @@ import os
import sys
import types
from xonsh.lazyasd import LazyObject
from xonsh.lazyimps import pyghooks, pygments
from xonsh.lib.lazyasd import LazyObject
from xonsh.lib.lazyimps import pyghooks, pygments
from xonsh.lib.openpy import read_py_file
from xonsh.lib.tokenize import detect_encoding
from xonsh.platform import HAS_PYGMENTS

View file

@ -3,7 +3,7 @@
import importlib
import os
from xonsh.lazyasd import LazyObject, lazyobject
from xonsh.lib.lazyasd import LazyObject, lazyobject
from xonsh.platform import ON_DARWIN, ON_WINDOWS
pygments = LazyObject(

View file

@ -15,7 +15,7 @@ This file was forked from the IPython project:
import io
import re
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
from xonsh.lib.tokenize import detect_encoding, tokopen
cookie_comment_re = LazyObject(

View file

@ -86,7 +86,7 @@ import re
import sys
import types
from xonsh.lazyasd import LazyObject, lazyobject
from xonsh.lib.lazyasd import LazyObject, lazyobject
__all__ = [
"pretty",

View file

@ -81,7 +81,7 @@ from token import (
tok_name,
)
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
from xonsh.platform import PYTHON_VERSION_INFO
cookie_re = LazyObject(

View file

@ -17,8 +17,8 @@ from xonsh.environ import get_home_xonshrc_path, make_args_env, xonshrc_context
from xonsh.events import events
from xonsh.execer import Execer
from xonsh.imphooks import install_import_hooks
from xonsh.lazyasd import lazyobject
from xonsh.lazyimps import pyghooks, pygments
from xonsh.lib.lazyasd import lazyobject
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

View file

@ -1,6 +1,6 @@
"""Implements the xonsh parser."""
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.platform import PYTHON_VERSION_INFO

View file

@ -10,7 +10,7 @@ from ast import parse as pyparse
from collections.abc import Iterable, Mapping, Sequence
from threading import Thread
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
from xonsh.lib.tokenize import SearchPath, StringPrefix
from xonsh.parsers import ast
from xonsh.parsers.ast import has_elts, load_attribute_chain, xonsh_call

View file

@ -17,7 +17,7 @@ from typing import (
overload,
)
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers.base import Location, raise_parse_error
from xonsh.parsers.lexer import Lexer
from xonsh.parsers.ply import yacc

View file

@ -3,7 +3,7 @@
import re
from ast import parse as pyparse
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers import ast
from xonsh.platform import PYTHON_VERSION_INFO

View file

@ -10,7 +10,7 @@ import keyword as kwmod
import re
import typing as tp
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.lib.tokenize import (
CASE,
COMMENT,

View file

@ -14,7 +14,7 @@ import signal
import subprocess
import sys
from xonsh.lazyasd import LazyBool, lazybool, lazyobject
from xonsh.lib.lazyasd import LazyBool, lazybool, lazyobject
# do not import any xonsh-modules here to avoid circular dependencies

View file

@ -40,8 +40,9 @@ from ctypes.wintypes import (
WORD,
)
from xonsh import lazyimps, platform
from xonsh.lazyasd import lazyobject
from xonsh import platform
from xonsh.lib import lazyimps
from xonsh.lib.lazyasd import lazyobject
__all__ = ("sudo",)

View file

@ -14,7 +14,7 @@ import typing as tp
from xonsh.built_ins import XSH
from xonsh.cli_utils import Annotated, Arg, ArgParserAlias
from xonsh.completers.tools import RichCompletion
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
from xonsh.platform import FD_STDERR, LIBC, ON_CYGWIN, ON_DARWIN, ON_MSYS, ON_WINDOWS
from xonsh.tools import get_signal_name, on_main_thread, unthreadable

View file

@ -9,7 +9,7 @@ import sys
import threading
import time
import xonsh.lazyasd as xl
import xonsh.lib.lazyasd as xl
import xonsh.platform as xp
import xonsh.procs.jobs as xj
import xonsh.tools as xt

View file

@ -9,8 +9,8 @@ import sys
import threading
import time
import xonsh.lazyasd as xl
import xonsh.lazyimps as xli
import xonsh.lib.lazyasd as xl
import xonsh.lib.lazyimps as xli
import xonsh.platform as xp
import xonsh.tools as xt
from xonsh.built_ins import XSH

View file

@ -16,7 +16,7 @@ import sys
import threading
import time
import xonsh.lazyimps as xli
import xonsh.lib.lazyimps as xli
import xonsh.platform as xp
import xonsh.tools as xt
from xonsh.built_ins import XSH

View file

@ -8,7 +8,7 @@ import sys
import threading
import time
import xonsh.lazyimps as xli
import xonsh.lib.lazyimps as xli
from xonsh.built_ins import XSH

View file

@ -13,8 +13,8 @@ import subprocess
import sys
import xonsh.environ as xenv
import xonsh.lazyasd as xl
import xonsh.lazyimps as xli
import xonsh.lib.lazyasd as xl
import xonsh.lib.lazyimps as xli
import xonsh.platform as xp
import xonsh.procs.jobs as xj
import xonsh.tools as xt

View file

@ -12,7 +12,7 @@ import threading
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
RE_REMOVE_ANSI = LazyObject(
lambda: re.compile(r"(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]"),

View file

@ -40,8 +40,8 @@ from xonsh.color_tools import (
)
from xonsh.commands_cache import CommandsCache
from xonsh.events import events
from xonsh.lazyasd import LazyDict, LazyObject, lazyobject
from xonsh.lazyimps import html, os_listxattr, terminal256
from xonsh.lib.lazyasd import LazyDict, LazyObject, lazyobject
from xonsh.lib.lazyimps import html, os_listxattr, terminal256
from xonsh.platform import (
os_environ,
ptk_version_info,

View file

@ -17,7 +17,7 @@ from xonsh.codecache import (
)
from xonsh.completer import Completer
from xonsh.events import events
from xonsh.lazyimps import pyghooks, pygments
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

View file

@ -26,7 +26,7 @@ from prompt_toolkit.styles.pygments import pygments_token_to_classname
from xonsh.built_ins import XSH
from xonsh.events import events
from xonsh.lazyimps import pyghooks, pygments, winutils
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.shells.base_shell import BaseShell

View file

@ -28,8 +28,8 @@ from xonsh.ansi_colors import (
)
from xonsh.built_ins import XSH
from xonsh.events import events
from xonsh.lazyasd import LazyObject, lazyobject
from xonsh.lazyimps import pyghooks, pygments, winutils
from xonsh.lib.lazyasd import LazyObject, lazyobject
from xonsh.lib.lazyimps import pyghooks, pygments, winutils
from xonsh.platform import (
ON_CYGWIN,
ON_DARWIN,

View file

@ -3,7 +3,7 @@
from collections import defaultdict
from xonsh.color_tools import RE_BACKGROUND, iscolor, warn_deprecated_no_color
from xonsh.lazyasd import LazyObject
from xonsh.lib.lazyasd import LazyObject
from xonsh.platform import HAS_PYGMENTS
from xonsh.tools import FORMATTER

View file

@ -17,8 +17,7 @@ import timeit
from xonsh.built_ins import XSH
from xonsh.events import events
from xonsh.lazyasd import lazybool, lazyobject
from xonsh.platform import ON_WINDOWS
from xonsh.lib.lazyasd import lazybool, lazyobject
@lazybool

View file

@ -44,7 +44,7 @@ from contextlib import contextmanager
# adding imports from further xonsh modules is discouraged to avoid circular
# dependencies
from xonsh import __version__
from xonsh.lazyasd import LazyDict, LazyObject, lazyobject
from xonsh.lib.lazyasd import LazyDict, LazyObject, lazyobject
from xonsh.platform import (
DEFAULT_ENCODING,
HAS_PYGMENTS,

View file

@ -11,9 +11,9 @@ import typing as tp
import xonsh.procs.pipelines as xpp
import xonsh.prompt.cwd as prompt
from xonsh.cli_utils import Annotated, Arg, ArgParserAlias
from xonsh.lazyasd import LazyObject
from xonsh.lazyimps import pyghooks, pygments
from xonsh.lib.inspectors import find_file
from xonsh.lib.lazyasd import LazyObject
from xonsh.lib.lazyimps import pyghooks, pygments
from xonsh.platform import HAS_PYGMENTS
from xonsh.tools import DefaultNotGiven, normabspath, print_color, to_bool

View file

@ -19,7 +19,7 @@ from xonsh.built_ins import XSH
from xonsh.cli_utils import Arg, ArgParserAlias
from xonsh.events import events
from xonsh.foreign_shells import CANON_SHELL_NAMES
from xonsh.lazyasd import lazyobject
from xonsh.lib.lazyasd import lazyobject
from xonsh.parsers import ply
from xonsh.platform import (
DEFAULT_ENCODING,

View file

@ -3,7 +3,7 @@
import os
import re
import xonsh.lazyasd as xl
import xonsh.lib.lazyasd as xl
@xl.lazyobject

View file

@ -19,7 +19,7 @@ import struct
import sys
import time
import xonsh.lazyimps as xlimps
import xonsh.lib.lazyimps as xlimps
import xonsh.platform as xp