Replace isort with ruff

This commit is contained in:
Kovid Goyal
2023-01-09 16:47:42 +05:30
parent f15d27bb62
commit 7fe5d7b58f
157 changed files with 876 additions and 732 deletions

View File

@@ -14,8 +14,19 @@ from gettext import gettext as _
from itertools import chain
from time import monotonic
from typing import (
TYPE_CHECKING, Any, Callable, Deque, Dict, Iterable, List, NamedTuple, Optional,
Pattern, Sequence, Tuple, Union,
TYPE_CHECKING,
Any,
Callable,
Deque,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Pattern,
Sequence,
Tuple,
Union,
)
from .child import ProcessDesc
@@ -23,26 +34,75 @@ from .cli_stub import CLIOptions
from .clipboard import ClipboardRequestManager, set_clipboard_string
from .config import build_ansi_color_table
from .constants import (
appname, clear_handled_signals, config_dir, is_macos, wakeup_io_loop,
appname,
clear_handled_signals,
config_dir,
is_macos,
wakeup_io_loop,
)
from .fast_data_types import (
BGIMAGE_PROGRAM, BLIT_PROGRAM, CELL_BG_PROGRAM, CELL_FG_PROGRAM, CELL_PROGRAM,
CELL_SPECIAL_PROGRAM, CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE, DCS, DECORATION,
DECORATION_MASK, DIM, GLFW_MOD_CONTROL, GRAPHICS_ALPHA_MASK_PROGRAM,
GRAPHICS_PREMULT_PROGRAM, GRAPHICS_PROGRAM, MARK, MARK_MASK, NO_CURSOR_SHAPE,
NUM_UNDERLINE_STYLES, OSC, REVERSE, SCROLL_FULL, SCROLL_LINE, SCROLL_PAGE,
STRIKETHROUGH, TINT_PROGRAM, Color, KeyEvent, Screen, add_timer, add_window,
cell_size_for_window, click_mouse_cmd_output, click_mouse_url, compile_program,
current_focused_os_window_id, encode_key_for_tty, get_boss, get_click_interval,
get_options, init_cell_program, last_focused_os_window_id, mark_os_window_dirty,
mouse_selection, move_cursor_to_mouse_if_in_prompt, pt_to_px, set_titlebar_color,
set_window_logo, set_window_padding, set_window_render_data,
update_ime_position_for_window, update_window_title, update_window_visibility,
BGIMAGE_PROGRAM,
BLIT_PROGRAM,
CELL_BG_PROGRAM,
CELL_FG_PROGRAM,
CELL_PROGRAM,
CELL_SPECIAL_PROGRAM,
CURSOR_BEAM,
CURSOR_BLOCK,
CURSOR_UNDERLINE,
DCS,
DECORATION,
DECORATION_MASK,
DIM,
GLFW_MOD_CONTROL,
GRAPHICS_ALPHA_MASK_PROGRAM,
GRAPHICS_PREMULT_PROGRAM,
GRAPHICS_PROGRAM,
MARK,
MARK_MASK,
NO_CURSOR_SHAPE,
NUM_UNDERLINE_STYLES,
OSC,
REVERSE,
SCROLL_FULL,
SCROLL_LINE,
SCROLL_PAGE,
STRIKETHROUGH,
TINT_PROGRAM,
Color,
KeyEvent,
Screen,
add_timer,
add_window,
cell_size_for_window,
click_mouse_cmd_output,
click_mouse_url,
compile_program,
current_focused_os_window_id,
encode_key_for_tty,
get_boss,
get_click_interval,
get_options,
init_cell_program,
last_focused_os_window_id,
mark_os_window_dirty,
mouse_selection,
move_cursor_to_mouse_if_in_prompt,
pt_to_px,
set_titlebar_color,
set_window_logo,
set_window_padding,
set_window_render_data,
update_ime_position_for_window,
update_window_title,
update_window_visibility,
wakeup_main_loop,
)
from .keys import keyboard_mode_name, mod_mask
from .notify import (
NotificationCommand, handle_notification_cmd, sanitize_identifier_pat,
NotificationCommand,
handle_notification_cmd,
sanitize_identifier_pat,
)
from .options.types import Options
from .rgb import to_color
@@ -50,9 +110,19 @@ from .terminfo import get_capabilities
from .types import MouseEvent, OverlayType, WindowGeometry, ac, run_once
from .typing import BossType, ChildType, EdgeLiteral, TabType, TypedDict
from .utils import (
docs_url, kitty_ansi_sanitizer_pat, load_shaders, log_error, open_cmd, open_url,
parse_color_set, path_from_osc7_url, resolve_custom_file, resolved_shell,
sanitize_for_bracketed_paste, sanitize_title, sanitize_url_for_dispay_to_user,
docs_url,
kitty_ansi_sanitizer_pat,
load_shaders,
log_error,
open_cmd,
open_url,
parse_color_set,
path_from_osc7_url,
resolve_custom_file,
resolved_shell,
sanitize_for_bracketed_paste,
sanitize_title,
sanitize_url_for_dispay_to_user,
)
MatchPatternType = Union[Pattern[str], Tuple[Pattern[str], Optional[Pattern[str]]]]