mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-14 04:24:52 +02:00
Replace isort with ruff
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user