mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 09:48:09 +02:00
Replace isort with ruff
This commit is contained in:
@@ -6,7 +6,14 @@ import re
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
from typing import (
|
||||
TYPE_CHECKING, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple,
|
||||
TYPE_CHECKING,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
NamedTuple,
|
||||
Optional,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
from kitty.cli import parse_args
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
|
||||
def match(
|
||||
lines: List[bytes], levels: Tuple[str, str, str], needle: str,
|
||||
output_positions: bool, limit: int, num_threads: int, mark_before: str,
|
||||
|
||||
@@ -6,9 +6,7 @@ from contextlib import suppress
|
||||
from fnmatch import fnmatch
|
||||
from functools import lru_cache
|
||||
from hashlib import md5
|
||||
from typing import (
|
||||
TYPE_CHECKING, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Union
|
||||
)
|
||||
from typing import TYPE_CHECKING, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Union
|
||||
|
||||
from kitty.guess_mime_type import guess_type
|
||||
from kitty.utils import control_codes_pat
|
||||
|
||||
@@ -5,13 +5,13 @@ import os
|
||||
from typing import Any, Dict, Iterable, Optional
|
||||
|
||||
from kitty.cli_stub import DiffCLIOptions
|
||||
from kitty.conf.utils import (
|
||||
load_config as _load_config, parse_config_base, resolve_config
|
||||
)
|
||||
from kitty.conf.utils import load_config as _load_config
|
||||
from kitty.conf.utils import parse_config_base, resolve_config
|
||||
from kitty.constants import config_dir
|
||||
from kitty.rgb import color_as_sgr
|
||||
|
||||
from .options.types import Options as DiffOptions, defaults
|
||||
from .options.types import Options as DiffOptions
|
||||
from .options.types import defaults
|
||||
|
||||
formats: Dict[str, str] = {
|
||||
'title': '',
|
||||
@@ -41,9 +41,7 @@ defconf = os.path.join(config_dir, 'diff.conf')
|
||||
|
||||
|
||||
def load_config(*paths: str, overrides: Optional[Iterable[str]] = None) -> DiffOptions:
|
||||
from .options.parse import (
|
||||
create_result_dict, merge_result_dicts, parse_conf_item
|
||||
)
|
||||
from .options.parse import create_result_dict, merge_result_dicts, parse_conf_item
|
||||
|
||||
def parse_config(lines: Iterable[str]) -> Dict[str, Any]:
|
||||
ans: Dict[str, Any] = create_result_dict()
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import List, Optional, Tuple
|
||||
|
||||
from .collect import Segment
|
||||
|
||||
|
||||
def split_with_highlights(
|
||||
line: str, truncate_points: List[int], fg_highlights: List[Segment],
|
||||
bg_highlight: Optional[Segment]
|
||||
|
||||
@@ -5,9 +5,7 @@ import concurrent
|
||||
import os
|
||||
import re
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from typing import (
|
||||
IO, Dict, Iterable, Iterator, List, Optional, Tuple, Union, cast
|
||||
)
|
||||
from typing import IO, Dict, Iterable, Iterator, List, Optional, Tuple, Union, cast
|
||||
|
||||
from pygments import highlight # type: ignore
|
||||
from pygments.formatter import Formatter # type: ignore
|
||||
|
||||
@@ -14,7 +14,15 @@ from enum import Enum, auto
|
||||
from functools import partial
|
||||
from gettext import gettext as _
|
||||
from typing import (
|
||||
Any, DefaultDict, Dict, Iterable, Iterator, List, Optional, Tuple, Union,
|
||||
Any,
|
||||
DefaultDict,
|
||||
Dict,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
from kitty.cli import CONFIG_HELP, CompletionSpec, parse_args
|
||||
@@ -32,20 +40,32 @@ from ..tui.loop import Loop
|
||||
from ..tui.operations import styled
|
||||
from . import global_data
|
||||
from .collect import (
|
||||
Collection, add_remote_dir, create_collection, data_for_path, lines_for_path,
|
||||
sanitize, set_highlight_data,
|
||||
Collection,
|
||||
add_remote_dir,
|
||||
create_collection,
|
||||
data_for_path,
|
||||
lines_for_path,
|
||||
sanitize,
|
||||
set_highlight_data,
|
||||
)
|
||||
from .config import init_config
|
||||
from .options.types import Options as DiffOptions
|
||||
from .patch import Differ, Patch, set_diff_command, worker_processes
|
||||
from .render import (
|
||||
ImagePlacement, ImageSupportWarning, Line, LineRef, Reference, render_diff,
|
||||
ImagePlacement,
|
||||
ImageSupportWarning,
|
||||
Line,
|
||||
LineRef,
|
||||
Reference,
|
||||
render_diff,
|
||||
)
|
||||
from .search import BadRegex, Search
|
||||
|
||||
try:
|
||||
from .highlight import (
|
||||
DiffHighlight, get_highlight_processes, highlight_collection,
|
||||
DiffHighlight,
|
||||
get_highlight_processes,
|
||||
highlight_collection,
|
||||
initialize_highlighter,
|
||||
)
|
||||
has_highlighter = True
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
from kitty.conf.types import Action, Definition
|
||||
|
||||
|
||||
definition = Definition(
|
||||
'kittens.diff',
|
||||
Action('map', 'parse_map', {'key_definitions': 'kitty.conf.utils.KittensKeyMap'}, ['kitty.types.ParsedShortcut', 'kitty.conf.utils.KeyAction']),
|
||||
|
||||
1
kittens/diff/options/parse.py
generated
1
kittens/diff/options/parse.py
generated
@@ -1,6 +1,7 @@
|
||||
# generated by gen-config.py DO NOT edit
|
||||
|
||||
import typing
|
||||
|
||||
from kittens.diff.options.utils import parse_map, store_multiple, syntax_aliases
|
||||
from kitty.conf.utils import merge_dicts, positive_int, python_string, to_color, to_color_or_none
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
|
||||
from typing import Any, Container, Dict, Iterable, Tuple, Union
|
||||
|
||||
from kitty.conf.utils import (
|
||||
KeyFuncWrapper, KittensKeyDefinition, parse_kittens_key
|
||||
)
|
||||
from kitty.conf.utils import KeyFuncWrapper, KittensKeyDefinition, parse_kittens_key
|
||||
|
||||
ReturnType = Tuple[str, Any]
|
||||
func_with_args = KeyFuncWrapper[ReturnType]()
|
||||
|
||||
@@ -13,10 +13,7 @@ from kitty.types import run_once
|
||||
from kitty.utils import ScreenSize
|
||||
|
||||
from ..tui.images import ImageManager, can_display_images
|
||||
from .collect import (
|
||||
Collection, Segment, data_for_path, highlights_for_path, is_image,
|
||||
lines_for_path, path_name_map, sanitize
|
||||
)
|
||||
from .collect import Collection, Segment, data_for_path, highlights_for_path, is_image, lines_for_path, path_name_map, sanitize
|
||||
from .config import formats
|
||||
from .diff_speedup import split_with_highlights as _split_with_highlights
|
||||
from .patch import Chunk, Hunk, Patch
|
||||
|
||||
@@ -5,9 +5,9 @@ import re
|
||||
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Tuple
|
||||
|
||||
from kitty.fast_data_types import wcswidth
|
||||
from .options.types import Options as DiffOptions
|
||||
|
||||
from ..tui.operations import styled
|
||||
from .options.types import Options as DiffOptions
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .render import Line
|
||||
|
||||
@@ -8,10 +8,7 @@ import sys
|
||||
from functools import lru_cache
|
||||
from gettext import gettext as _
|
||||
from itertools import repeat
|
||||
from typing import (
|
||||
Any, Callable, Dict, Generator, Iterable, Iterator, List, Optional,
|
||||
Pattern, Sequence, Set, Tuple, Type, cast
|
||||
)
|
||||
from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Optional, Pattern, Sequence, Set, Tuple, Type, cast
|
||||
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import HintsCLIOptions
|
||||
@@ -20,10 +17,7 @@ from kitty.constants import website_url
|
||||
from kitty.fast_data_types import get_options, wcswidth
|
||||
from kitty.key_encoding import KeyEvent
|
||||
from kitty.typing import BossType, KittyCommonOpts
|
||||
from kitty.utils import (
|
||||
ScreenSize, kitty_ansi_sanitizer_pat, resolve_custom_file,
|
||||
screen_size_function
|
||||
)
|
||||
from kitty.utils import ScreenSize, kitty_ansi_sanitizer_pat, resolve_custom_file, screen_size_function
|
||||
|
||||
from ..tui.handler import Handler, result_handler
|
||||
from ..tui.loop import Loop
|
||||
|
||||
@@ -137,6 +137,7 @@ if __name__ == '__main__':
|
||||
raise SystemExit('This should be run as kitty-tool icat')
|
||||
elif __name__ == '__doc__':
|
||||
import sys
|
||||
|
||||
from kitty.cli import CompletionSpec
|
||||
cd = sys.cli_docs # type: ignore
|
||||
cd['usage'] = usage
|
||||
|
||||
@@ -8,8 +8,8 @@ from typing import Any, Callable, Dict, List, Tuple
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import PanelCLIOptions
|
||||
from kitty.constants import appname, is_macos
|
||||
from kitty.os_window_size import WindowSizeData
|
||||
from kitty.fast_data_types import make_x11_window_a_dock_window
|
||||
from kitty.os_window_size import WindowSizeData
|
||||
|
||||
OPTIONS = r'''
|
||||
--lines
|
||||
@@ -134,7 +134,8 @@ def main(sys_args: List[str]) -> None:
|
||||
for override in args.override:
|
||||
sys.argv.extend(('--override', override))
|
||||
sys.argv.extend(items)
|
||||
from kitty.main import main as real_main, run_app
|
||||
from kitty.main import main as real_main
|
||||
from kitty.main import run_app
|
||||
run_app.cached_values_name = 'panel'
|
||||
run_app.first_window_callback = setup_x11_window
|
||||
run_app.initial_window_size_func = initial_window_size_func
|
||||
|
||||
@@ -5,7 +5,7 @@ import re
|
||||
import sys
|
||||
from binascii import hexlify, unhexlify
|
||||
from contextlib import suppress
|
||||
from typing import Dict, Iterable, List, Type, Optional
|
||||
from typing import Dict, Iterable, List, Optional, Type
|
||||
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import QueryTerminalCLIOptions
|
||||
|
||||
@@ -16,17 +16,12 @@ from kitty.cli import parse_args
|
||||
from kitty.cli_stub import RemoteFileCLIOptions
|
||||
from kitty.constants import cache_dir
|
||||
from kitty.typing import BossType
|
||||
from kitty.utils import (
|
||||
SSHConnectionData, command_for_open, get_editor, open_cmd
|
||||
)
|
||||
from kitty.utils import SSHConnectionData, command_for_open, get_editor, open_cmd
|
||||
|
||||
from ..tui.handler import result_handler
|
||||
from ..tui.operations import (
|
||||
faint, raw_mode, reset_terminal, styled
|
||||
)
|
||||
from ..tui.operations import faint, raw_mode, reset_terminal, styled
|
||||
from ..tui.utils import get_key_press
|
||||
|
||||
|
||||
is_ssh_kitten_sentinel = '!#*&$#($ssh-kitten)(##$'
|
||||
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ def launch(args: List[str]) -> None:
|
||||
finally:
|
||||
sys.stdin = sys.__stdin__
|
||||
if result is not None:
|
||||
import json
|
||||
import base64
|
||||
import json
|
||||
data = base64.b85encode(json.dumps(result).encode('utf-8'))
|
||||
sys.stdout.buffer.write(b'\x1bP@kitty-kitten-result|')
|
||||
sys.stdout.buffer.write(data)
|
||||
|
||||
@@ -33,6 +33,7 @@ def real_main(args: List[str]) -> None:
|
||||
print(error_message, flush=True)
|
||||
if data.get('tb'):
|
||||
import select
|
||||
|
||||
from kittens.tui.operations import init_state, set_cursor_visible
|
||||
fd, original_termios = open_tty()
|
||||
msg = '\n\r\x1b[1;32mPress e to see detailed traceback or any other key to exit\x1b[m'
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from kitty.key_encoding import (
|
||||
ALT, CAPS_LOCK, CTRL, HYPER, META, NUM_LOCK, PRESS, RELEASE, REPEAT, SHIFT,
|
||||
SUPER, KeyEvent, encode_key_event
|
||||
)
|
||||
|
||||
from kittens.tui.handler import Handler
|
||||
from kittens.tui.loop import Loop
|
||||
from kitty.key_encoding import ALT, CAPS_LOCK, CTRL, HYPER, META, NUM_LOCK, PRESS, RELEASE, REPEAT, SHIFT, SUPER, KeyEvent, encode_key_event
|
||||
|
||||
mod_names = {
|
||||
SHIFT: 'Shift',
|
||||
|
||||
@@ -6,9 +6,9 @@ import os
|
||||
import sys
|
||||
from typing import List
|
||||
|
||||
from kittens.tui.operations import raw_mode, styled
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import ShowKeyCLIOptions
|
||||
from kittens.tui.operations import raw_mode, styled
|
||||
|
||||
ctrl_keys = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ import fnmatch
|
||||
import os
|
||||
from typing import Any, Dict, Iterable, Optional
|
||||
|
||||
from kitty.conf.utils import (
|
||||
load_config as _load_config, parse_config_base, resolve_config
|
||||
)
|
||||
from kitty.conf.utils import load_config as _load_config
|
||||
from kitty.conf.utils import parse_config_base, resolve_config
|
||||
from kitty.constants import config_dir
|
||||
|
||||
from .options.types import Options as SSHOptions, defaults
|
||||
from .options.types import Options as SSHOptions
|
||||
from .options.types import defaults
|
||||
|
||||
SYSTEM_CONF = '/etc/xdg/kitty/ssh.conf'
|
||||
defconf = os.path.join(config_dir, 'ssh.conf')
|
||||
@@ -28,12 +28,8 @@ def host_matches(mpat: str, hostname: str, username: str) -> bool:
|
||||
|
||||
|
||||
def load_config(*paths: str, overrides: Optional[Iterable[str]] = None, hostname: str = '!', username: str = '') -> SSHOptions:
|
||||
from .options.parse import (
|
||||
create_result_dict, merge_result_dicts, parse_conf_item
|
||||
)
|
||||
from .options.utils import (
|
||||
first_seen_positions, get_per_hosts_dict, init_results_dict
|
||||
)
|
||||
from .options.parse import create_result_dict, merge_result_dicts, parse_conf_item
|
||||
from .options.utils import first_seen_positions, get_per_hosts_dict, init_results_dict
|
||||
|
||||
def merge_dicts(base: Dict[str, Any], vals: Dict[str, Any]) -> Dict[str, Any]:
|
||||
base_phd = get_per_hosts_dict(base)
|
||||
|
||||
@@ -6,9 +6,7 @@ import glob
|
||||
import os
|
||||
import shlex
|
||||
import uuid
|
||||
from typing import (
|
||||
Dict, Iterable, Iterator, List, NamedTuple, Optional, Sequence, Tuple
|
||||
)
|
||||
from typing import Dict, Iterable, Iterator, List, NamedTuple, Optional, Sequence, Tuple
|
||||
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import CopyCLIOptions
|
||||
|
||||
@@ -22,27 +22,16 @@ from base64 import standard_b64decode, standard_b64encode
|
||||
from contextlib import contextmanager, suppress
|
||||
from getpass import getuser
|
||||
from select import select
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterator, List, NoReturn, Optional, Sequence, Set,
|
||||
Tuple, Union, cast
|
||||
)
|
||||
from typing import Any, Callable, Dict, Iterator, List, NoReturn, Optional, Sequence, Set, Tuple, Union, cast
|
||||
|
||||
from kitty.constants import (
|
||||
cache_dir, runtime_dir, shell_integration_dir, ssh_control_master_template,
|
||||
str_version, terminfo_dir
|
||||
)
|
||||
from kitty.constants import cache_dir, runtime_dir, shell_integration_dir, ssh_control_master_template, str_version, terminfo_dir
|
||||
from kitty.shell_integration import as_str_literal
|
||||
from kitty.shm import SharedMemory
|
||||
from kitty.types import run_once
|
||||
from kitty.utils import (
|
||||
SSHConnectionData, expandvars, resolve_abs_or_config_path,
|
||||
set_echo as turn_off_echo
|
||||
)
|
||||
from kitty.utils import SSHConnectionData, expandvars, resolve_abs_or_config_path
|
||||
from kitty.utils import set_echo as turn_off_echo
|
||||
|
||||
from ..tui.operations import (
|
||||
RESTORE_PRIVATE_MODE_VALUES, SAVE_PRIVATE_MODE_VALUES, Mode,
|
||||
restore_colors, save_colors, set_mode
|
||||
)
|
||||
from ..tui.operations import RESTORE_PRIVATE_MODE_VALUES, SAVE_PRIVATE_MODE_VALUES, Mode, restore_colors, save_colors, set_mode
|
||||
from ..tui.utils import kitty_opts, running_in_tmux
|
||||
from .config import init_config
|
||||
from .copy import CopyInstruction
|
||||
@@ -624,9 +613,7 @@ def drain_potential_tty_garbage(p: 'subprocess.Popen[bytes]', data_request: str)
|
||||
def change_colors(color_scheme: str) -> bool:
|
||||
if not color_scheme:
|
||||
return False
|
||||
from kittens.themes.collection import (
|
||||
NoCacheFound, load_themes, text_as_opts
|
||||
)
|
||||
from kittens.themes.collection import NoCacheFound, load_themes, text_as_opts
|
||||
from kittens.themes.main import colors_as_escape_codes
|
||||
if color_scheme.endswith('.conf'):
|
||||
conf_file = resolve_abs_or_config_path(color_scheme)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
from kitty.conf.types import Definition
|
||||
|
||||
|
||||
copy_message = '''\
|
||||
Copy files and directories from local to remote hosts. The specified files are
|
||||
assumed to be relative to the HOME directory and copied to the HOME on the
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# generated by gen-config.py DO NOT edit
|
||||
|
||||
import typing
|
||||
|
||||
from kittens.ssh.options.utils import copy, env, hostname
|
||||
from kitty.conf.utils import merge_dicts, to_bool
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
from contextlib import suppress
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterator, Match, Optional, Tuple, Type, Union
|
||||
)
|
||||
from typing import Any, Callable, Dict, Iterator, Match, Optional, Tuple, Type, Union
|
||||
from urllib.error import HTTPError
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ import sys
|
||||
import traceback
|
||||
from enum import Enum, auto
|
||||
from gettext import gettext as _
|
||||
from typing import (
|
||||
Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
||||
)
|
||||
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from kitty.cli import CompletionSpec, create_default_opts, parse_args
|
||||
from kitty.cli_stub import ThemesCLIOptions
|
||||
|
||||
@@ -5,10 +5,7 @@ import os
|
||||
import tempfile
|
||||
from typing import IO, TYPE_CHECKING, Iterator, Union
|
||||
|
||||
from .rsync import (
|
||||
IO_BUFFER_SIZE, RsyncError, begin_create_delta, begin_create_signature,
|
||||
begin_load_signature, begin_patch, build_hash_table, iter_job
|
||||
)
|
||||
from .rsync import IO_BUFFER_SIZE, RsyncError, begin_create_delta, begin_create_signature, begin_load_signature, begin_patch, build_hash_table, iter_job
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .rsync import JobCapsule, SignatureCapsule
|
||||
|
||||
@@ -12,7 +12,6 @@ from kitty.cli_stub import TransferCLIOptions
|
||||
from .receive import receive_main
|
||||
from .send import send_main
|
||||
|
||||
|
||||
usage = 'source_files_or_directories destination_path'
|
||||
help_text = 'Transfer files over the TTY device'
|
||||
|
||||
|
||||
@@ -14,9 +14,16 @@ from typing import IO, Deque, Dict, Iterator, List, Optional, Union
|
||||
from kitty.cli_stub import TransferCLIOptions
|
||||
from kitty.fast_data_types import FILE_TRANSFER_CODE, wcswidth
|
||||
from kitty.file_transmission import (
|
||||
Action, Compression, FileTransmissionCommand, FileType,
|
||||
IdentityDecompressor, NameReprEnum, TransmissionType, ZlibDecompressor,
|
||||
encode_bypass, split_for_transfer
|
||||
Action,
|
||||
Compression,
|
||||
FileTransmissionCommand,
|
||||
FileType,
|
||||
IdentityDecompressor,
|
||||
NameReprEnum,
|
||||
TransmissionType,
|
||||
ZlibDecompressor,
|
||||
encode_bypass,
|
||||
split_for_transfer,
|
||||
)
|
||||
from kitty.typing import KeyEventType, ScreenSize
|
||||
from kitty.utils import sanitize_control_codes
|
||||
@@ -28,10 +35,7 @@ from ..tui.spinners import Spinner
|
||||
from ..tui.utils import human_size
|
||||
from .librsync import PatchFile, signature_of_file
|
||||
from .send import Transfer
|
||||
from .utils import (
|
||||
expand_home, print_rsync_stats, random_id, render_progress_in_width,
|
||||
safe_divide, should_be_compressed
|
||||
)
|
||||
from .utils import expand_home, print_rsync_stats, random_id, render_progress_in_width, safe_divide, should_be_compressed
|
||||
|
||||
debug
|
||||
file_counter = count(1)
|
||||
|
||||
@@ -9,17 +9,11 @@ from collections import deque
|
||||
from enum import auto
|
||||
from itertools import count
|
||||
from time import monotonic
|
||||
from typing import (
|
||||
IO, Callable, Deque, Dict, Iterable, Iterator, List, Optional, Sequence,
|
||||
Set, Tuple, Union
|
||||
)
|
||||
from typing import IO, Callable, Deque, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Tuple, Union
|
||||
|
||||
from kitty.cli_stub import TransferCLIOptions
|
||||
from kitty.fast_data_types import FILE_TRANSFER_CODE, wcswidth
|
||||
from kitty.file_transmission import (
|
||||
Action, Compression, FileTransmissionCommand, FileType, NameReprEnum,
|
||||
TransmissionType, encode_bypass, split_for_transfer
|
||||
)
|
||||
from kitty.file_transmission import Action, Compression, FileTransmissionCommand, FileType, NameReprEnum, TransmissionType, encode_bypass, split_for_transfer
|
||||
from kitty.typing import KeyEventType, ScreenSize
|
||||
from kitty.utils import sanitize_control_codes
|
||||
|
||||
@@ -30,9 +24,16 @@ from ..tui.spinners import Spinner
|
||||
from ..tui.utils import human_size
|
||||
from .librsync import LoadSignature, delta_for_file
|
||||
from .utils import (
|
||||
IdentityCompressor, ZlibCompressor, abspath, expand_home, home_path,
|
||||
print_rsync_stats, random_id, render_progress_in_width, safe_divide,
|
||||
should_be_compressed
|
||||
IdentityCompressor,
|
||||
ZlibCompressor,
|
||||
abspath,
|
||||
expand_home,
|
||||
home_path,
|
||||
print_rsync_stats,
|
||||
random_id,
|
||||
render_progress_in_width,
|
||||
safe_divide,
|
||||
should_be_compressed,
|
||||
)
|
||||
|
||||
debug
|
||||
|
||||
@@ -6,16 +6,21 @@ from collections import deque
|
||||
from contextlib import suppress
|
||||
from time import monotonic
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
TYPE_CHECKING, Any, Callable, ContextManager, Deque, Dict, NamedTuple,
|
||||
Optional, Sequence, Type, Union, cast
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any, Callable, ContextManager, Deque, Dict, NamedTuple, Optional, Sequence, Type, Union, cast
|
||||
|
||||
from kitty.types import DecoratedFunc, ParsedShortcut
|
||||
from kitty.typing import (
|
||||
AbstractEventLoop, BossType, Debug, ImageManagerType, KeyActionType,
|
||||
KeyEventType, LoopType, MouseButton, MouseEvent, ScreenSize,
|
||||
TermManagerType
|
||||
AbstractEventLoop,
|
||||
BossType,
|
||||
Debug,
|
||||
ImageManagerType,
|
||||
KeyActionType,
|
||||
KeyEventType,
|
||||
LoopType,
|
||||
MouseButton,
|
||||
MouseEvent,
|
||||
ScreenSize,
|
||||
TermManagerType,
|
||||
)
|
||||
|
||||
from .operations import MouseTracking, pending_update
|
||||
|
||||
@@ -9,17 +9,11 @@ from collections import defaultdict, deque
|
||||
from contextlib import suppress
|
||||
from enum import IntEnum
|
||||
from itertools import count
|
||||
from typing import (
|
||||
Any, Callable, ClassVar, DefaultDict, Deque, Dict, Generic, Iterator, List,
|
||||
Optional, Sequence, Tuple, Type, TypeVar, Union, cast
|
||||
)
|
||||
from typing import Any, Callable, ClassVar, DefaultDict, Deque, Dict, Generic, Iterator, List, Optional, Sequence, Tuple, Type, TypeVar, Union, cast
|
||||
|
||||
from kitty.conf.utils import positive_float, positive_int
|
||||
from kitty.fast_data_types import create_canvas
|
||||
from kitty.typing import (
|
||||
GRT_C, CompletedProcess, GRT_a, GRT_d, GRT_f, GRT_m, GRT_o, GRT_t,
|
||||
HandlerType
|
||||
)
|
||||
from kitty.typing import GRT_C, CompletedProcess, GRT_a, GRT_d, GRT_f, GRT_m, GRT_o, GRT_t, HandlerType
|
||||
from kitty.utils import ScreenSize, fit_image, which
|
||||
|
||||
from .operations import cursor
|
||||
|
||||
@@ -6,9 +6,7 @@ from typing import Callable, Tuple
|
||||
from kitty.fast_data_types import truncate_point_for_length, wcswidth
|
||||
from kitty.key_encoding import EventType, KeyEvent
|
||||
|
||||
from .operations import (
|
||||
RESTORE_CURSOR, SAVE_CURSOR, move_cursor_by, set_cursor_shape
|
||||
)
|
||||
from .operations import RESTORE_CURSOR, SAVE_CURSOR, move_cursor_by, set_cursor_shape
|
||||
|
||||
|
||||
class LineEdit:
|
||||
|
||||
@@ -16,17 +16,10 @@ from functools import partial
|
||||
from typing import Any, Callable, Dict, Generator, List, NamedTuple, Optional
|
||||
|
||||
from kitty.constants import is_macos
|
||||
from kitty.fast_data_types import (
|
||||
FILE_TRANSFER_CODE, close_tty, normal_tty, open_tty,
|
||||
parse_input_from_terminal, raw_tty
|
||||
)
|
||||
from kitty.key_encoding import (
|
||||
ALT, CTRL, SHIFT, backspace_key, decode_key_event, enter_key
|
||||
)
|
||||
from kitty.fast_data_types import FILE_TRANSFER_CODE, close_tty, normal_tty, open_tty, parse_input_from_terminal, raw_tty
|
||||
from kitty.key_encoding import ALT, CTRL, SHIFT, backspace_key, decode_key_event, enter_key
|
||||
from kitty.typing import ImageManagerType, KeyEventType, Protocol
|
||||
from kitty.utils import (
|
||||
ScreenSize, ScreenSizeGetter, screen_size_function, write_all
|
||||
)
|
||||
from kitty.utils import ScreenSize, ScreenSizeGetter, screen_size_function, write_all
|
||||
|
||||
from .handler import Handler
|
||||
from .operations import MouseTracking, init_state, reset_state
|
||||
|
||||
@@ -9,9 +9,7 @@ from typing import IO, Any, Callable, Dict, Generator, Optional, TypeVar, Union
|
||||
|
||||
from kitty.fast_data_types import Color
|
||||
from kitty.rgb import color_as_sharp, to_color
|
||||
from kitty.typing import (
|
||||
GraphicsCommandType, HandlerType, ScreenSize, UnderlineLiteral
|
||||
)
|
||||
from kitty.typing import GraphicsCommandType, HandlerType, ScreenSize, UnderlineLiteral
|
||||
|
||||
from .operations_stub import CMD
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
|
||||
from .operations import styled, repeat
|
||||
from .operations import repeat, styled
|
||||
|
||||
|
||||
def render_progress_bar(frac: float, width: int = 80) -> str:
|
||||
|
||||
@@ -7,10 +7,7 @@ import sys
|
||||
from contextlib import suppress
|
||||
from functools import lru_cache
|
||||
from gettext import gettext as _
|
||||
from typing import (
|
||||
Any, Dict, FrozenSet, Generator, Iterable, List, Optional, Sequence, Tuple,
|
||||
Union
|
||||
)
|
||||
from typing import Any, Dict, FrozenSet, Generator, Iterable, List, Optional, Sequence, Tuple, Union
|
||||
|
||||
from kitty.cli import parse_args
|
||||
from kitty.cli_stub import UnicodeCLIOptions
|
||||
@@ -24,10 +21,7 @@ from kitty.utils import ScreenSize, get_editor
|
||||
from ..tui.handler import Handler, result_handler
|
||||
from ..tui.line_edit import LineEdit
|
||||
from ..tui.loop import Loop
|
||||
from ..tui.operations import (
|
||||
clear_screen, colored, cursor, faint, set_line_wrapping, set_window_title,
|
||||
sgr, styled
|
||||
)
|
||||
from ..tui.operations import clear_screen, colored, cursor, faint, set_line_wrapping, set_window_title, sgr, styled
|
||||
from ..tui.utils import report_unhandled_error
|
||||
|
||||
HEX, NAME, EMOTICONS, FAVORITES = 'HEX', 'NAME', 'EMOTICONS', 'FAVORITES'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from typing import Tuple, FrozenSet, Optional
|
||||
|
||||
from typing import FrozenSet, Optional, Tuple
|
||||
|
||||
def all_words() -> Tuple[str, ...]:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user