mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-04-24 22:57:13 -04:00
Upgraded vendored Python dependencies to the latest versions and removed the unused dependencies.
This commit is contained in:
parent
36bf0d219d
commit
0c3c5a02a7
2108 changed files with 306789 additions and 151391 deletions
|
@ -1,4 +1,4 @@
|
|||
from typing import Callable, Dict, Iterable, List, TYPE_CHECKING, Union
|
||||
from typing import Any, Callable, Dict, Iterable, List, TYPE_CHECKING, Union
|
||||
|
||||
from .segment import ControlCode, ControlType, Segment
|
||||
|
||||
|
@ -14,7 +14,7 @@ STRIP_CONTROL_CODES = [
|
|||
_CONTROL_TRANSLATE = {_codepoint: None for _codepoint in STRIP_CONTROL_CODES}
|
||||
|
||||
|
||||
CONTROL_CODES_FORMAT: Dict[int, Callable] = {
|
||||
CONTROL_CODES_FORMAT: Dict[int, Callable[..., str]] = {
|
||||
ControlType.BELL: lambda: "\x07",
|
||||
ControlType.CARRIAGE_RETURN: lambda: "\r",
|
||||
ControlType.HOME: lambda: "\x1b[H",
|
||||
|
@ -27,7 +27,7 @@ CONTROL_CODES_FORMAT: Dict[int, Callable] = {
|
|||
ControlType.CURSOR_DOWN: lambda param: f"\x1b[{param}B",
|
||||
ControlType.CURSOR_FORWARD: lambda param: f"\x1b[{param}C",
|
||||
ControlType.CURSOR_BACKWARD: lambda param: f"\x1b[{param}D",
|
||||
ControlType.CURSOR_MOVE_TO_ROW: lambda param: f"\x1b[{param+1}G",
|
||||
ControlType.CURSOR_MOVE_TO_COLUMN: lambda param: f"\x1b[{param+1}G",
|
||||
ControlType.ERASE_IN_LINE: lambda param: f"\x1b[{param}K",
|
||||
ControlType.CURSOR_MOVE_TO: lambda x, y: f"\x1b[{y+1};{x+1}H",
|
||||
}
|
||||
|
@ -93,8 +93,8 @@ class Control:
|
|||
return control
|
||||
|
||||
@classmethod
|
||||
def move_to_row(cls, x: int, y: int = 0) -> "Control":
|
||||
"""Move to the given row, optionally add offset to column.
|
||||
def move_to_column(cls, x: int, y: int = 0) -> "Control":
|
||||
"""Move to the given column, optionally add offset to row.
|
||||
|
||||
Returns:
|
||||
x (int): absolute x (column)
|
||||
|
@ -106,14 +106,14 @@ class Control:
|
|||
|
||||
return (
|
||||
cls(
|
||||
(ControlType.CURSOR_MOVE_TO_ROW, x + 1),
|
||||
(ControlType.CURSOR_MOVE_TO_COLUMN, x),
|
||||
(
|
||||
ControlType.CURSOR_DOWN if y > 0 else ControlType.CURSOR_UP,
|
||||
abs(y),
|
||||
),
|
||||
)
|
||||
if y
|
||||
else cls((ControlType.CURSOR_MOVE_TO_ROW, x))
|
||||
else cls((ControlType.CURSOR_MOVE_TO_COLUMN, x))
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@ -157,7 +157,9 @@ class Control:
|
|||
yield self.segment
|
||||
|
||||
|
||||
def strip_control_codes(text: str, _translate_table=_CONTROL_TRANSLATE) -> str:
|
||||
def strip_control_codes(
|
||||
text: str, _translate_table: Dict[int, None] = _CONTROL_TRANSLATE
|
||||
) -> str:
|
||||
"""Remove control codes from text.
|
||||
|
||||
Args:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue