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