mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
[pre-commit.ci] pre-commit autoupdate (#5271)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
7389b082df
commit
66c0490d37
114 changed files with 150 additions and 46 deletions
|
@ -7,7 +7,7 @@ ci:
|
|||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.12.1
|
||||
rev: 24.1.1
|
||||
hooks:
|
||||
- id: black
|
||||
entry: black xonsh xontrib tests xompletions
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh.procs.specs"""
|
||||
|
||||
import itertools
|
||||
import sys
|
||||
from subprocess import Popen
|
||||
|
|
|
@ -204,15 +204,12 @@ def test_register_decorator(xession):
|
|||
aliases = Aliases()
|
||||
|
||||
@aliases.register
|
||||
def debug():
|
||||
...
|
||||
def debug(): ...
|
||||
|
||||
@aliases.register("name")
|
||||
def with_options():
|
||||
...
|
||||
def with_options(): ...
|
||||
|
||||
@aliases.register
|
||||
def _private():
|
||||
...
|
||||
def _private(): ...
|
||||
|
||||
assert set(aliases) == {"debug", "name", "private"}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests ANSI color tools."""
|
||||
|
||||
import pytest
|
||||
|
||||
from xonsh.ansi_colors import (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Xonsh AST tests."""
|
||||
|
||||
import ast as pyast
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""(A down payment on) Testing for ``xonsh.base_shell.BaseShell`` and associated classes"""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh builtins."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests color tools."""
|
||||
|
||||
import pytest
|
||||
|
||||
from xonsh.color_tools import iscolor
|
||||
|
|
|
@ -738,9 +738,11 @@ MULTIPLE_COMMAND_BORDER_EXAMPLES = tuple(
|
|||
(
|
||||
(
|
||||
f"ls{ws1}{X}{kwd}{ws2}echo",
|
||||
(
|
||||
CommandContext((CommandArg("ls"),), 1)
|
||||
if ws1
|
||||
else CommandContext((), 0, prefix="ls"),
|
||||
else CommandContext((), 0, prefix="ls")
|
||||
),
|
||||
),
|
||||
)
|
||||
for ws1, ws2, kwd in itertools.product(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests xonsh contexts."""
|
||||
|
||||
from textwrap import dedent
|
||||
|
||||
from xonsh.contexts import Block, Functor
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Testing dirstack"""
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh environment."""
|
||||
|
||||
import datetime
|
||||
import os
|
||||
import pathlib
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Event tests"""
|
||||
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh lexer."""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests foreign shells."""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the json history backend."""
|
||||
|
||||
# pylint: disable=protected-access
|
||||
|
||||
import shlex
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh history."""
|
||||
|
||||
# pylint: disable=protected-access
|
||||
import itertools
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Testing xonsh import hooks"""
|
||||
|
||||
import os
|
||||
from importlib import import_module
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Tests involving running Xonsh in subproc.
|
||||
This requires Xonsh installed in venv or otherwise available on PATH
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess as sp
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Testing xonsh json hooks"""
|
||||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests lazy and self destruictive objects."""
|
||||
|
||||
from xonsh.lazyasd import LazyObject
|
||||
|
||||
#
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests lazy json functionality."""
|
||||
|
||||
from io import StringIO
|
||||
|
||||
from xonsh.lazyjson import LazyJSON, LJNode, index, ljdump
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh lexer."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh main function."""
|
||||
|
||||
import builtins
|
||||
import gc
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Testing that news entries are well formed."""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh parser."""
|
||||
|
||||
import ast
|
||||
import itertools
|
||||
import textwrap
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
"""Test XonshLexer for pygments"""
|
||||
|
||||
|
||||
import pytest
|
||||
from pygments.token import (
|
||||
Error,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests sample inputs to PTK multiline and checks parser response"""
|
||||
|
||||
from collections import namedtuple
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests pygments hooks."""
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
import stat
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Testing for ``xonsh.shell.Shell``"""
|
||||
|
||||
import os
|
||||
|
||||
from xonsh.history.dummy import DummyHistory
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests xonsh tools."""
|
||||
|
||||
import datetime as dt
|
||||
import os
|
||||
import pathlib
|
||||
|
@ -1426,9 +1427,11 @@ def test_is_logfile_opt(inp, exp):
|
|||
pytest.param("/dev/null", "/dev/null", marks=skip_if_on_windows),
|
||||
pytest.param(
|
||||
"/dev/nonexistent_dev",
|
||||
(
|
||||
"/dev/nonexistent_dev"
|
||||
if is_writable_file("/dev/nonexistent_dev")
|
||||
else None,
|
||||
else None
|
||||
),
|
||||
marks=skip_if_on_windows,
|
||||
),
|
||||
("~/log", os.path.expanduser("~/log")),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh lexer."""
|
||||
|
||||
import os
|
||||
|
||||
import pytest # noqa F401
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
- xonfig jupyter_kernel
|
||||
|
||||
"""
|
||||
|
||||
import io
|
||||
import re
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""xontrib tests, such as they are"""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Aliases for the xonsh shell."""
|
||||
|
||||
import argparse
|
||||
import collections.abc as cabc
|
||||
import functools
|
||||
|
@ -85,8 +86,7 @@ class Aliases(cabc.MutableMapping):
|
|||
@tp.overload
|
||||
def register(
|
||||
self, name: str, *, dash_case: bool = True
|
||||
) -> tp.Callable[[types.FunctionType], types.FunctionType]:
|
||||
...
|
||||
) -> tp.Callable[[types.FunctionType], types.FunctionType]: ...
|
||||
|
||||
def register(self, func_or_name, name=None, dash_case=True):
|
||||
"""Decorator to register the given function by name."""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tools for helping with ANSI color codes."""
|
||||
|
||||
import re
|
||||
import sys
|
||||
import warnings
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Abstract Syntax Tree handler"""
|
||||
|
||||
# These are imported into our module namespace for the benefit of parser.py.
|
||||
# pylint: disable=unused-import
|
||||
import itertools
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""The base class for xonsh shell"""
|
||||
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
Note that this module is named 'built_ins' so as not to be confused with the
|
||||
special Python builtins module.
|
||||
"""
|
||||
|
||||
import atexit
|
||||
import builtins
|
||||
import collections.abc as cabc
|
||||
|
|
|
@ -442,9 +442,7 @@ class ArgparseCompleter:
|
|||
nargs = (
|
||||
act.nargs
|
||||
if isinstance(act.nargs, int)
|
||||
else args_len + 1
|
||||
if act.nargs in {ap.ONE_OR_MORE, ap.ZERO_OR_MORE}
|
||||
else 1
|
||||
else args_len + 1 if act.nargs in {ap.ONE_OR_MORE, ap.ZERO_OR_MORE} else 1
|
||||
)
|
||||
if len(self.remaining_args) >= nargs:
|
||||
# consume n-number of args
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tools for caching xonsh code."""
|
||||
|
||||
import hashlib
|
||||
import marshal
|
||||
import os
|
||||
|
|
|
@ -5,6 +5,7 @@ color codes. Parts of this file were originally forked from Micah Elliott
|
|||
http://MicahElliott.com Copyright (C) 2011 Micah Elliott. All rights reserved.
|
||||
WTFPL http://sam.zoy.org/wtfpl/
|
||||
"""
|
||||
|
||||
import math
|
||||
import re
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ A background predictor is a function that accepts a single argument list
|
|||
and returns whether or not the process can be run in the background (returns
|
||||
True) or must be run the foreground (returns False).
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import collections.abc as cabc
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""A (tab-)completer for xonsh."""
|
||||
|
||||
import collections.abc as cabc
|
||||
import sys
|
||||
import typing as tp
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Base completer for xonsh."""
|
||||
|
||||
import collections.abc as cabc
|
||||
|
||||
from xonsh.completers.commands import complete_command
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""This module provides the implementation for the retrieving completion results
|
||||
from bash.
|
||||
"""
|
||||
|
||||
import functools
|
||||
|
||||
# developer note: this file should not perform any action on import.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Constructor for xonsh completer objects."""
|
||||
|
||||
import collections
|
||||
|
||||
from xonsh.completers._aliases import complete_aliases
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Completers for Python code"""
|
||||
|
||||
import builtins
|
||||
import collections.abc as cabc
|
||||
import inspect
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Xonsh completer tools."""
|
||||
|
||||
import inspect
|
||||
import os
|
||||
import shlex
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Context management tools for xonsh."""
|
||||
|
||||
import sys
|
||||
import textwrap
|
||||
from collections.abc import Mapping
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tools for diff'ing two xonsh history files in a meaningful fashion."""
|
||||
|
||||
import datetime
|
||||
import difflib
|
||||
import itertools
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Directory stack and associated utilities for the xonsh shell.
|
||||
https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import glob
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Environment for the xonsh shell."""
|
||||
|
||||
import collections.abc as cabc
|
||||
import contextlib
|
||||
import inspect
|
||||
|
@ -407,9 +408,11 @@ class LsColors(cabc.MutableMapping):
|
|||
+ "="
|
||||
+ ";".join(
|
||||
[
|
||||
(
|
||||
LsColors.target_value
|
||||
if key in self._targets
|
||||
else ansi_color_name_to_escape_code(v, cmap=style)
|
||||
)
|
||||
for v in val
|
||||
]
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ The best way to "declare" an event is something like::
|
|||
|
||||
events.doc('on_spam', "Comes with eggs")
|
||||
"""
|
||||
|
||||
import abc
|
||||
import collections.abc
|
||||
import inspect
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh executer."""
|
||||
|
||||
import builtins
|
||||
import collections.abc as cabc
|
||||
import inspect
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tools to help interface with foreign shells, such as Bash."""
|
||||
|
||||
import collections.abc as cabc
|
||||
import functools
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Base class of Xonsh History backends."""
|
||||
|
||||
import functools
|
||||
import re
|
||||
import types
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh history backend."""
|
||||
|
||||
import collections
|
||||
|
||||
from xonsh.history.base import History
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements JSON version of xonsh history backend."""
|
||||
|
||||
import collections
|
||||
import collections.abc as cabc
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Main entry points of the xonsh history."""
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh history backend via sqlite3."""
|
||||
|
||||
import collections
|
||||
import json
|
||||
import os
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
This module registers the hooks it defines when it is imported.
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import importlib
|
||||
import os
|
||||
|
|
|
@ -7,6 +7,7 @@ This file was forked from the IPython project:
|
|||
* Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
|
||||
* Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import itertools
|
||||
import linecache
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Job control for the xonsh shell."""
|
||||
|
||||
import collections
|
||||
import contextlib
|
||||
import ctypes
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Custom tools for managing JSON serialization / deserialization of xonsh
|
||||
objects.
|
||||
"""
|
||||
|
||||
import functools
|
||||
|
||||
from xonsh.tools import EnvPath
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Lazy and self destructive containers for speeding up module import."""
|
||||
|
||||
# Copyright 2015-2016, the xonsh developers. All rights reserved.
|
||||
import builtins
|
||||
import collections.abc as cabc
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Lazy imports that may apply across the xonsh package."""
|
||||
|
||||
import importlib
|
||||
import os
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements a lazy JSON file class that wraps around json data."""
|
||||
|
||||
import collections.abc as cabc
|
||||
import contextlib
|
||||
import io
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
Written using a hybrid of ``tokenize`` and PLY.
|
||||
"""
|
||||
|
||||
import io
|
||||
|
||||
# 'keyword' interferes with ast.keyword
|
||||
|
@ -266,11 +267,7 @@ def _make_matcher_handler(tok, typ, pymode, ender, handlers):
|
|||
matcher = (
|
||||
")"
|
||||
if tok.endswith("(")
|
||||
else "}"
|
||||
if tok.endswith("{")
|
||||
else "]"
|
||||
if tok.endswith("[")
|
||||
else None
|
||||
else "}" if tok.endswith("{") else "]" if tok.endswith("[") else None
|
||||
)
|
||||
|
||||
def _inner_handler(state, token):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Xonsh extension of the standard library os module, using xonsh for
|
||||
subprocess calls"""
|
||||
|
||||
import sys
|
||||
|
||||
from xonsh.built_ins import subproc_uncaptured
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Provides some Mac / Darwin based utility functions for xonsh."""
|
||||
|
||||
from ctypes import byref, c_uint, create_string_buffer
|
||||
|
||||
from xonsh.platform import LIBC
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""The main xonsh script."""
|
||||
|
||||
import argparse
|
||||
import builtins
|
||||
import contextlib
|
||||
|
|
|
@ -11,6 +11,7 @@ This file was forked from the IPython project:
|
|||
* Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
|
||||
* Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
|
||||
"""
|
||||
|
||||
import io
|
||||
import re
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh parser."""
|
||||
|
||||
from xonsh.lazyasd import lazyobject
|
||||
from xonsh.platform import PYTHON_VERSION_INFO
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the base xonsh parser."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import textwrap
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Implements the xonsh (tab-)completion context parser.
|
||||
This parser is meant to parse a (possibly incomplete) command line.
|
||||
"""
|
||||
|
||||
import enum
|
||||
import os
|
||||
import re
|
||||
|
@ -208,8 +209,7 @@ class Spanned(Generic[T]):
|
|||
expansion_obj: Union[
|
||||
"ExpandableObject", ExpansionOperation, Missing
|
||||
] = Missing.MISSING,
|
||||
) -> "Spanned[T]":
|
||||
...
|
||||
) -> "Spanned[T]": ...
|
||||
|
||||
@overload
|
||||
def replace(
|
||||
|
@ -222,8 +222,7 @@ class Spanned(Generic[T]):
|
|||
expansion_obj: Union[
|
||||
"ExpandableObject", ExpansionOperation, Missing
|
||||
] = Missing.MISSING,
|
||||
) -> "Spanned[T2]":
|
||||
...
|
||||
) -> "Spanned[T2]": ...
|
||||
|
||||
def replace(
|
||||
self,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements helper class for parsing Xonsh syntax within f-strings."""
|
||||
|
||||
import re
|
||||
from ast import parse as pyparse
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh parser for Python v3.6."""
|
||||
|
||||
import xonsh.ast as ast
|
||||
from xonsh.parsers.base import BaseParser, lopen_loc, store_ctx
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Implements the xonsh parser for Python v3.8."""
|
||||
|
||||
import xonsh.ast as ast
|
||||
from xonsh.parsers.base import store_ctx
|
||||
from xonsh.parsers.v36 import Parser as ThreeSixParser
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
compatibility layers to make use of the 'best' implementation available
|
||||
on a platform.
|
||||
"""
|
||||
|
||||
import collections.abc as cabc
|
||||
import ctypes # noqa
|
||||
import functools
|
||||
|
|
|
@ -77,6 +77,7 @@ without open / close parameters. You can also use this code::
|
|||
Portions (c) 2009 by Robert Kern.
|
||||
:license: BSD License.
|
||||
"""
|
||||
|
||||
import collections
|
||||
import contextlib
|
||||
import datetime
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""xonsh.proc is deprecated"""
|
||||
|
||||
from xonsh.lazyasd import lazyobject
|
||||
from xonsh.tools import print_warning
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Command pipeline tools."""
|
||||
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Interface for running subprocess-mode commands on posix systems."""
|
||||
|
||||
import array
|
||||
import io
|
||||
import os
|
||||
|
|
|
@ -6,6 +6,7 @@ The contents of `subprocess.py` (and, thus, the reproduced methods) are
|
|||
Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se> and were
|
||||
licensed to the Python Software foundation under a Contributor Agreement.
|
||||
"""
|
||||
|
||||
import collections.abc as cabc
|
||||
import functools
|
||||
import inspect
|
||||
|
@ -512,12 +513,12 @@ class ProcProxyThread(threading.Thread):
|
|||
if self.env and self.env.get("__ALIAS_NAME"):
|
||||
alias_stack += ":" + self.env["__ALIAS_NAME"]
|
||||
|
||||
with STDOUT_DISPATCHER.register(sp_stdout), STDERR_DISPATCHER.register(
|
||||
sp_stderr
|
||||
), xt.redirect_stdout(STDOUT_DISPATCHER), xt.redirect_stderr(
|
||||
STDERR_DISPATCHER
|
||||
), XSH.env.swap(
|
||||
self.env, __ALIAS_STACK=alias_stack
|
||||
with (
|
||||
STDOUT_DISPATCHER.register(sp_stdout),
|
||||
STDERR_DISPATCHER.register(sp_stderr),
|
||||
xt.redirect_stdout(STDOUT_DISPATCHER),
|
||||
xt.redirect_stderr(STDERR_DISPATCHER),
|
||||
XSH.env.swap(self.env, __ALIAS_STACK=alias_stack),
|
||||
):
|
||||
r = self.f(self.args, sp_stdin, sp_stdout, sp_stderr, spec, spec.stack)
|
||||
except SystemExit as e:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""File handle readers and related tools."""
|
||||
|
||||
import ctypes
|
||||
import io
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Subprocess specification and related utilities."""
|
||||
|
||||
import contextlib
|
||||
import inspect
|
||||
import io
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Prompt formatter for virtualenv and others"""
|
||||
|
||||
import functools
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""date & time related prompt formatter"""
|
||||
|
||||
import time
|
||||
|
||||
from xonsh.built_ins import XSH
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Prompt formatter for simple version control branches"""
|
||||
|
||||
# pylint:disable=no-member, invalid-name
|
||||
import contextlib
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Completer implementation to use with prompt_toolkit."""
|
||||
|
||||
import os
|
||||
|
||||
from prompt_toolkit.application.current import get_app
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""The prompt_toolkit based xonsh shell."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Hooks for pygments syntax highlighting."""
|
||||
|
||||
import os
|
||||
import re
|
||||
import stat
|
||||
|
@ -555,12 +556,16 @@ def register_custom_pygments_style(
|
|||
(Style,),
|
||||
{
|
||||
"styles": custom_styles,
|
||||
"highlight_color": highlight_color
|
||||
"highlight_color": (
|
||||
highlight_color
|
||||
if highlight_color is not None
|
||||
else base_style.highlight_color,
|
||||
"background_color": background_color
|
||||
else base_style.highlight_color
|
||||
),
|
||||
"background_color": (
|
||||
background_color
|
||||
if background_color is not None
|
||||
else base_style.background_color,
|
||||
else base_style.background_color
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ The cache file is created on first use, if it does not already exist.
|
|||
|
||||
|
||||
"""
|
||||
|
||||
import importlib
|
||||
import os
|
||||
import typing as tp
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Tests the xonsh lexer."""
|
||||
|
||||
import ast
|
||||
import copy
|
||||
import os
|
||||
|
|
|
@ -9,6 +9,7 @@ are included from the IPython project. The IPython project is:
|
|||
* Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
|
||||
|
||||
"""
|
||||
|
||||
import cmd
|
||||
import collections
|
||||
import importlib
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""The xonsh shell"""
|
||||
|
||||
import difflib
|
||||
import sys
|
||||
import time
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Xonsh color styling tools that simulate pygments, when it is unavailable."""
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from xonsh.color_tools import RE_BACKGROUND, iscolor, warn_deprecated_no_color
|
||||
|
|
|
@ -6,6 +6,7 @@ The following time_it alias and Timer was forked from the IPython project:
|
|||
* Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
|
||||
* Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
|
||||
"""
|
||||
|
||||
import gc
|
||||
import itertools
|
||||
import math
|
||||
|
|
|
@ -16,6 +16,7 @@ Implementations:
|
|||
* indent()
|
||||
|
||||
"""
|
||||
|
||||
import ast
|
||||
import collections
|
||||
import collections.abc as cabc
|
||||
|
@ -1790,9 +1791,7 @@ def to_completion_mode(x):
|
|||
y = (
|
||||
"default"
|
||||
if y in ("", "d", "xonsh", "none", "def")
|
||||
else "menu-complete"
|
||||
if y in ("m", "menu", "menu-completion")
|
||||
else y
|
||||
else "menu-complete" if y in ("m", "menu", "menu-completion") else y
|
||||
)
|
||||
if y not in CANONIC_COMPLETION_MODES:
|
||||
warnings.warn(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue