repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
kitty | kitty/key_names.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from collections.abc import Callable
from contextlib import suppress
from typing import Optional
from .constants import is_macos
functional_key_name_aliases: dict[str, str] = {
'ESC': 'ESCAPE',
'PGUP': 'P... | 102 | 2,602 |
kitty | kitty/typing_compat.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
BossType = ChildType = TabType = WindowType = ScreenType = object
BadLineType = SequenceMap = KeyActionType = AliasMap = object
AddressFamily = PopenType = Socket = StartupCtx = object
SessionTab = SessionType = LayoutType =... | 26 | 951 |
kitty | kitty/choose_entry.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
import re
from collections.abc import Generator
from typing import Any
from .cli_stub import HintsCLIOptions
from .typing_compat import MarkType
def mark(text: str, args: HintsCLIOptions, Mark: type[MarkType], extra_cli_ar... | 27 | 865 |
kitty | kitty/session.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import json
import os
import re
import shlex
import sys
from collections.abc import Callable, Generator, Iterator, Mapping, Sequence
from contextlib import suppress
from functools import partial
from gettext import gettext a... | 737 | 29,022 |
kitty | kitty/tab_bar.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from collections.abc import Callable, Sequence
from functools import lru_cache, partial, wraps
from string import Formatter as StringFormatter
from typing import (
Any,
Literal,
NamedTuple,
)
... | 1,171 | 45,827 |
kitty | kitty/short_uuid.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import math
import string
import uuid as _uuid
from collections.abc import Sequence
def num_to_string(number: int, alphabet: Sequence[str], alphabet_len: int, pad_to_length: int | None = None) -> str:
ans = []
numbe... | 65 | 2,343 |
kitty | kitty/shell_integration.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import subprocess
from collections.abc import Callable, Iterable
from contextlib import suppress
from .constants import shell_integration_dir
from .fast_data_types import get_options
from .options.types ... | 257 | 8,590 |
kitty | kitty/render_cache.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import os
import time
from collections.abc import Iterator
from contextlib import closing, suppress
from functools import partial
from .constants import cache_dir, kitten_exe
from .utils import lock_file, unlock_file
class... | 130 | 4,600 |
kitty | kitty/machine_id.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2026, Kovid Goyal <kovid at kovidgoyal.net>
import hashlib
import hmac
from contextlib import suppress
from functools import lru_cache
from kitty.constants import is_macos
@lru_cache(maxsize=8)
def machine_id(salt: str = '') -> str:
mid = b''
if is_macos:
... | 26 | 688 |
kitty | kitty/entry_points.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import os
import sys
def icat(args: list[str]) -> None:
from kitty.constants import kitten_exe
os.execl(kitten_exe(), 'kitten', *args)
def list_fonts(args: list[str]) -> None:
from kitty.fonts.list import ma... | 158 | 4,678 |
kitty | kitty/cli.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import sys
import types
from collections.abc import Callable, Iterator, Sequence
from re import Match
from typing import Any, NoReturn, TypeVar, cast
from .cli_stub import CLIOptions
from .conf.utils imp... | 748 | 22,988 |
kitty | kitty/config.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import json
import os
from collections.abc import Callable, Generator, Iterable
from contextlib import contextmanager, suppress
from functools import partial
from typing import Any
from .conf.utils import BadLine, parse_con... | 235 | 8,174 |
kitty | kitty/xdg.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from contextlib import suppress
from kitty.types import run_once
@run_once
def xdg_data_dirs() -> tuple[str, ...]:
return tuple(os.environ.get('XDG_DATA_DIRS', '/usr/local/share/:/usr/share/').split... | 144 | 4,965 |
kitty | kitty/window_title_bar.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2024, kitty contributors
import os
from functools import lru_cache
from typing import Any, NamedTuple
from .constants import config_dir
from .fast_data_types import (
DECAWM,
Screen,
get_options,
)
from .rgb import color_as_sgr, color_from_int, to_color
f... | 191 | 6,527 |
kitty | kitty/os_window_size.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Callable
from typing import Any, NamedTuple
from .constants import is_macos, is_wayland
from .fast_data_types import get_options
from .options.types import Options
from .types import FloatEdges
fr... | 101 | 3,429 |
kitty | kitty/launch.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
import os
import shutil
from collections.abc import Callable, Container, Iterable, Iterator, Sequence
from contextlib import suppress
from typing import Any, Literal, NamedTuple, TypedDict
from .boss import Boss
from .child... | 1,333 | 51,321 |
kitty | kitty/colors.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import os
from collections.abc import Iterable, Sequence
from contextlib import suppress
from enum import Enum
from typing import Any, Literal, Optional, TypedDict, cast
from .config import parse_config
from .constants impor... | 323 | 13,372 |
kitty | kitty/actions.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import inspect
from typing import Any, NamedTuple
from .boss import Boss
from .tabs import Tab
from .types import ActionGroup, ActionSpec, run_once
from .window import Window
class Action(NamedTuple):
name: str
gro... | 135 | 3,954 |
kitty | kitty/terminfo.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from binascii import hexlify, unhexlify
from collections.abc import Generator
from typing import Literal, cast
from kitty.options.types import Options
def modify_key_bytes(keybytes: bytes, amt: int) ->... | 577 | 18,209 |
kitty | kitty/rc/new_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import NewWindowRCOp... | 98 | 3,363 |
kitty | kitty/rc/screenshot.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import os
from base64 import standard_b64encode
from typing import TYPE_CHECKING
from kitty.fast_data_types import png_from_32bit_rgba_data
from kitty.types import AsyncResponse
from .base import (
MATCH_TAB_OPTION,
... | 122 | 5,278 |
kitty | kitty/rc/send_key.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import (
MATCH_TAB_OPTION,
MATCH_WINDOW_OPTION,
ArgsType,
Boss,
PayloadGetType,
PayloadType,
RCOptions,
RemoteCommand,
ResponseType,
Window,... | 73 | 2,574 |
kitty | kitty/rc/select_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING, Optional
from kitty.types import AsyncResponse
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECK... | 96 | 3,253 |
kitty | kitty/rc/set_colors.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.cli import emph
from kitty.fast_data_types import Color
from .base import (
MATCH_TAB_OPTION,
MATCH_WINDOW_OPTION,
ArgsType,
Boss,
ParsingOfArgsFailed,
Pa... | 121 | 4,476 |
kitty | kitty/rc/resize_os_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import (
MATCH_WINDOW_OPTION,
ArgsType,
Boss,
PayloadGetType,
PayloadType,
RCOptions,
RemoteCommand,
RemoteControlErrorWithoutTraceback,
Respons... | 178 | 7,348 |
kitty | kitty/rc/set_font_size.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import SetFontSizeRCOptions as CLIOpti... | 51 | 2,301 |
kitty | kitty/rc/scroll_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING, Literal
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import ... | 94 | 4,572 |
kitty | kitty/rc/disable_ligatures.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stu... | 64 | 2,270 |
kitty | kitty/rc/set_background_opacity.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import (
MATCH_TAB_OPTION,
MATCH_WINDOW_OPTION,
ArgsType,
Boss,
OpacityError,
PayloadGetType,
PayloadType,
RCOptions,
RemoteCommand,
Respon... | 92 | 3,423 |
kitty | kitty/rc/send_text.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import base64
import sys
from typing import TYPE_CHECKING, Any
from kitty.fast_data_types import KeyEvent as WindowSystemKeyEvent
from kitty.fast_data_types import get_boss
from kitty.key_encoding import decode_key_event_as_... | 270 | 10,128 |
kitty | kitty/rc/signal_child.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import SignalChil... | 55 | 2,269 |
kitty | kitty/rc/goto_layout.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Iterable
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, UnknownLayout, Window
if TYPE_CH... | 57 | 2,171 |
kitty | kitty/rc/detach_tab.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, MatchError, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import D... | 55 | 1,991 |
kitty | kitty/rc/run.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from base64 import standard_b64decode, standard_b64encode
from typing import TYPE_CHECKING
from kitty.launch import env_docs, remote_control_password_docs
from kitty.options.utils import env as parse_env
from kitt... | 153 | 5,355 |
kitty | kitty/rc/set_enabled_layouts.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Iterable
from typing import TYPE_CHECKING
from kitty.fast_data_types import get_options
from kitty.options.utils import parse_layout_names
from .base import MATCH_TAB_OPTION, ArgsType, Boss, Payl... | 77 | 2,744 |
kitty | kitty/rc/action.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import (
MATCH_WINDOW_OPTION,
ArgsType,
Boss,
PayloadGetType,
PayloadType,
RCOptions,
RemoteCommand,
RemoteControlErrorWithoutTraceback,
Respon... | 84 | 2,680 |
kitty | kitty/rc/focus_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import FocusWind... | 43 | 1,390 |
kitty | kitty/rc/load_config.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.constants import appname
from .base import (
ArgsType,
Boss,
PayloadGetType,
PayloadType,
RCOptions,
RemoteCommand,
ResponseType,
Window,
)
if TY... | 79 | 2,747 |
kitty | kitty/rc/resize_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import ResizeWind... | 62 | 2,337 |
kitty | kitty/rc/remove_marker.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import RemoveMar... | 40 | 1,280 |
kitty | kitty/rc/set_window_title.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import SetWindowT... | 63 | 2,527 |
kitty | kitty/rc/set_spacing.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Iterable
from typing import TYPE_CHECKING, LiteralString
from .base import MATCH_TAB_OPTION, MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseTy... | 135 | 5,343 |
kitty | kitty/rc/get_text.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import GetTextRC... | 144 | 6,004 |
kitty | kitty/rc/set_background_image.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import os
from base64 import standard_b64decode, standard_b64encode
from io import BytesIO
from typing import TYPE_CHECKING
from kitty.types import AsyncResponse
from kitty.utils import is_png
from .base import (
MATCH_... | 167 | 5,931 |
kitty | kitty/rc/set_tab_color.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.rgb import to_color
from .base import MATCH_TAB_OPTION, ArgsType, Boss, ParsingOfArgsFailed, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_... | 82 | 3,031 |
kitty | kitty/rc/last_used_layout.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import LastUsedLayo... | 49 | 1,500 |
kitty | kitty/rc/get_colors.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.fast_data_types import Color
from kitty.rgb import color_as_sharp, color_from_int
from kitty.utils import natsort_ints
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, Paylo... | 71 | 2,618 |
kitty | kitty/rc/close_tab.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, MatchError, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import ... | 66 | 2,121 |
kitty | kitty/rc/set_window_logo.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import os
from base64 import standard_b64decode, standard_b64encode
from io import BytesIO
from typing import TYPE_CHECKING
from kitty.types import AsyncResponse
from kitty.utils import is_png
from .base import (
MATCH_... | 134 | 4,261 |
kitty | kitty/rc/ls.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import json
from collections.abc import Callable
from typing import TYPE_CHECKING
from kitty.constants import appname
from .base import MATCH_TAB_OPTION, MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCO... | 106 | 4,311 |
kitty | kitty/rc/focus_tab.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import FocusTabRCOp... | 48 | 1,491 |
kitty | kitty/rc/detach_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, MATCH_WINDOW_OPTION, ArgsType, Boss, MatchError, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from ki... | 71 | 2,831 |
kitty | kitty/rc/env.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import Any
from .base import ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
class Env(RemoteCommand):
protocol_spec = __doc__ = """
env+/dict.str: Dictionary... | 50 | 1,840 |
kitty | kitty/rc/launch.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import os
from typing import TYPE_CHECKING
from kitty.cli_stub import LaunchCLIOptions
from kitty.launch import launch as do_launch
from kitty.launch import options_spec as launch_options_spec
from kitty.launch import parse... | 182 | 8,206 |
kitty | kitty/rc/set_tab_title.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import SetTabTitleR... | 40 | 1,547 |
kitty | kitty/rc/create_marker.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.options.utils import parse_marker_spec
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_... | 53 | 2,111 |
kitty | kitty/rc/kitten.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import KittenRCOp... | 48 | 2,037 |
kitty | kitty/rc/base.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Callable, Iterable, Iterator
from contextlib import suppress
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, NoReturn, Optional, Union, cast
... | 480 | 20,801 |
kitty | kitty/rc/set_user_vars.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub import SetUserVar... | 51 | 2,033 |
kitty | kitty/rc/close_window.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, MatchError, PayloadGetType, PayloadType, RCOptions, RemoteCommand, ResponseType, Window
if TYPE_CHECKING:
from kitty.cli_stub impo... | 59 | 1,853 |
kitty | kitty/rc/set_os_window_title.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from typing import TYPE_CHECKING
from kitty.fast_data_types import set_os_window_title as set_os_window_title_impl
from .base import MATCH_WINDOW_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions, RemoteCommand... | 45 | 1,909 |
kitty | kitty/fonts/list.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Sequence
from kitty.constants import is_macos
from . import ListedFont
from .common import get_variable_data_for_descriptor
if is_macos:
from .core_text import list_fonts, prune_family_grou... | 45 | 1,298 |
kitty | kitty/fonts/render.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import os
import sys
from collections.abc import Callable, Generator
from typing import TYPE_CHECKING, Any, Literal, Union
from kitty.constants import fonts_dir, is_macos
from kitty.fast_data_types import (
Screen,
... | 389 | 13,773 |
kitty | kitty/fonts/__init__.py | .py | from collections.abc import Sequence
from enum import Enum, IntEnum, auto
from typing import TYPE_CHECKING, Literal, NamedTuple, TypedDict, Union
from kitty.fast_data_types import ParsedFontFeature
from kitty.types import run_once
from kitty.typing_compat import CoreTextFont, FontConfigPattern
from kitty.utils import ... | 243 | 6,446 |
kitty | kitty/fonts/core_text.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import itertools
import operator
from collections import defaultdict
from collections.abc import Generator, Iterable, Sequence
from functools import lru_cache
from typing import NamedTuple
from kitty.fast_data_types import ... | 275 | 10,351 |
kitty | kitty/fonts/fontconfig.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from collections.abc import Generator, Sequence
from functools import lru_cache
from typing import Literal, NamedTuple, Optional, cast
from kitty.fast_data_types import (
FC_DUAL,
FC_MONO,
FC_SLANT_IT... | 318 | 12,146 |
kitty | kitty/fonts/features.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
from enum import IntEnum
from typing import NamedTuple
class Type(IntEnum):
boolean = 1
index = 2
hidden = 3
class FeatureDefinition(NamedTuple):
name: str
type: Type
# From: https://learn.microsoft.... | 149 | 8,805 |
kitty | kitty/fonts/common.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
import copy
from typing import TYPE_CHECKING, Any, Literal, TypedDict, Union, cast
from kitty.constants import is_macos
from kitty.fast_data_types import ParsedFontFeature
from kitty.fonts import Descriptor, DesignAxis, Font... | 580 | 23,269 |
kitty | kitty/conf/types.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import builtins
import re
import textwrap
import typing
from collections.abc import Callable, Iterable, Iterator, Sequence
from functools import lru_cache
from importlib import import_module
from re import Match
from typing i... | 782 | 27,908 |
kitty | kitty/conf/generate.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import inspect
import os
import re
import textwrap
import types
from collections.abc import Callable, Iterator
from typing import Any, get_type_hints
from kitty.conf.types import Definition, MultiOption, Option, ParserFuncT... | 750 | 28,384 |
kitty | kitty/conf/utils.py | .py | #!/usr/bin/env python
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import sys
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from contextlib import contextmanager
from typing import (
Any,
Generic,
Literal,
NamedTuple,
T... | 575 | 17,949 |
kitty | kitty/shaders/validate_shaders.py | .py | #!/usr/bin/env python3
import subprocess
import sys
from pathlib import Path
from typing import Iterable
# Map the custom extensions to the required glslangValidator stage strings
stage_mapping = {
'.vert.glsl': 'vert',
'.frag.glsl': 'frag',
'.vertex.glsl': 'vert',
'.fragment.glsl': 'frag',
}
def val... | 77 | 2,411 |
kitty | kitty/shaders/slang.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2026, Kovid Goyal <kovid at kovidgoyal.net>
import glob
import hashlib
import json
import os
import re
import runpy
import shlex
import shutil
import subprocess
import sys
import tempfile
import time
import types
from collections import OrderedDict
from contextlib impo... | 1,608 | 64,554 |
kitty | kitty/shaders/custom/demo.py | .py | #!./kitty/launcher/kitty +launch
# License: GPLv3 Copyright: 2026, Kovid Goyal <kovid at kovidgoyal.net>
import glob
import math
import os
import signal
import subprocess
import sys
import tempfile
import time
from contextlib import suppress
from threading import Thread
from typing import Any
from kitty.constants imp... | 378 | 13,997 |
kitty | kitty/options/utils.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import enum
import re
import sys
from collections import defaultdict
from collections.abc import Callable, Container, Iterable, Iterator, Sequence
from contextlib import suppress
from dataclasses import dataclass, fields
fro... | 1,932 | 63,122 |
kitty | kitty/options/definition.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
# After editing this file run ./gen-config.py to apply the changes
import string
from kitty.conf.types import Action, Definition
from kitty.constants import website_url
from kitty.options.utils import pointer_shape_names
d... | 4,701 | 160,622 |
kitty | kitty/layout/splits.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Collection, Generator, Iterator, Sequence
from typing import Any, Optional, TypedDict, Union
from kitty.borders import BorderColor
from kitty.conf.utils import to_bool
from kitty.fast_data_types i... | 991 | 45,419 |
kitty | kitty/layout/vertical.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Generator, Iterable
from typing import Any
from kitty.borders import BorderColor
from kitty.types import Edges, NeighborsMap, WindowMapper
from kitty.typing_compat import EdgeLiteral, WindowType
f... | 166 | 6,947 |
kitty | kitty/layout/grid.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Callable, Generator, Iterator, Sequence
from functools import lru_cache
from itertools import repeat
from math import ceil, floor
from typing import Any
from kitty.borders import BorderColor
from ... | 315 | 13,921 |
kitty | kitty/layout/tall.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from collections.abc import Generator, Iterator, Sequence
from itertools import islice, repeat
from typing import Any
from kitty.borders import BorderColor
from kitty.conf.utils import to_bool
from kitty.fast_data... | 391 | 17,326 |
kitty | kitty/layout/stack.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from kitty.types import NeighborsMap
from kitty.typing_compat import WindowType
from kitty.window_list import WindowList
from .base import Layout
class Stack(Layout):
name = 'stack'
needs_window_borders = False
... | 29 | 1,075 |
kitty | kitty/layout/interface.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from .base import Layout
from .grid import Grid
from .splits import Splits
from .stack import Stack
from .tall import Fat, Tall
from .vertical import Horizontal, Vertical
all_layouts: dict[str, type[Layout]] = {
Stack.n... | 44 | 1,260 |
kitty | kitty/layout/base.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from collections.abc import Callable, Generator, Iterable, Iterator, Sequence
from enum import Enum
from functools import partial
from itertools import repeat
from typing import Any, ClassVar, NamedTuple, cast
from kitty.bor... | 594 | 24,169 |
kitty | glfw/glfw.py | .py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import sys
_plat = sys.platform.lower()
is_linux = 'linux' in _plat
is_openbsd = 'openbsd' in _plat
class Arg:
def __init__(self, decl: str):
self.type, self.name =... | 208 | 8,397 |
kitty | docs/notifications.py | .py | #!/usr/bin/env python
# A sample script to process notifications. Save it as
# ~/.config/kitty/notifications.py
import subprocess
from kitty.notifications import NotificationCommand, Urgency
def log_notification(nc: NotificationCommand) -> None:
# Log notifications to /tmp/notifications-log.txt
with open('... | 62 | 1,963 |
kitty | docs/extract-rst-targets.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from typing import Dict, Iterator
tgt_pat = re.compile(r'^.. _(\S+?):$', re.MULTILINE)
title_pat = re.compile('^(.+)\n[-=^#*]{5,}$', re.MULTILINE)
def find_explicit_targets(text: str) -> Iterator[str]:
... | 56 | 1,990 |
kitty | docs/conf.py | .py | #!/usr/bin/env python
# vim:fileencoding=utf-8
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# https://www.sphinx-doc.org/en/master/config
import glob
import os
import re
import subprocess
im... | 853 | 30,586 |
kitty | 3rdparty/base64/lib/tables/table_enc_12bit.py | .py | #!/usr/bin/python3
def tr(x):
"""Translate a 6-bit value to the Base64 alphabet."""
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789' + '+/'
return ord(s[x])
def table(fn):
"""Generate a 12-bit lookup table."""
ret = []
for n in range(0, 2**12):
pre = '\n... | 49 | 1,107 |
kitty | logo/make.py | .py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import json
import os
import shutil
import subprocess
import sys
from copy import deepcopy
from typing import Any
SRC = 'kitty.svg'
base = os.path.dirname(os.path.abspath(__file__))
# To generate t... | 130 | 3,970 |
kitty | shell-integration/ssh/bootstrap.py | .py | #!/usr/bin/env python
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import base64
import contextlib
import errno
import io
import json
import os
import pwd
import shutil
import subprocess
import sys
import tarfile
import tempfile
import termios
tty_file_obj = None
echo_on = int('ECHO_ON')
d... | 336 | 10,927 |
kitty | glad/generate.py | .py | #!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
import shlex
import shutil
import subprocess
cmdline = (
'glad --out-path {dest} --api gl:core=3.1 '
' --extensions GL_ARB_texture_storage,GL_ARB_copy_image,GL_ARB_multis... | 47 | 1,166 |
diffusers | setup.py | .py | # Copyright 2026 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 306 | 11,262 |
diffusers | benchmarks/push_results.py | .py | import os
import pandas as pd
from huggingface_hub import hf_hub_download, upload_file
from huggingface_hub.utils import EntryNotFoundError
REPO_ID = "diffusers/benchmarks"
def has_previous_benchmark() -> str:
from run_all import FINAL_CSV_FILENAME
csv_path = None
try:
csv_path = hf_hub_downlo... | 77 | 2,359 |
diffusers | benchmarks/benchmarking_utils.py | .py | import gc
import inspect
import logging
import os
import queue
import threading
from contextlib import nullcontext
from dataclasses import dataclass
from typing import Any, Callable
import pandas as pd
import torch
import torch.utils.benchmark as benchmark
from diffusers.models.modeling_utils import ModelMixin
from d... | 245 | 8,069 |
diffusers | benchmarks/run_all.py | .py | import glob
import logging
import os
import subprocess
import pandas as pd
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s")
logger = logging.getLogger(__name__)
PATTERN = "benchmarking_*.py"
FINAL_CSV_FILENAME = "collated_results.csv"
GITHUB_SHA = os.getenv("GITHUB_S... | 85 | 2,694 |
diffusers | benchmarks/benchmarking_flux.py | .py | from functools import partial
import torch
from benchmarking_utils import BenchmarkMixin, BenchmarkScenario, model_init_fn
from diffusers import BitsAndBytesConfig, FluxTransformer2DModel
from diffusers.utils.testing_utils import torch_device
CKPT_ID = "black-forest-labs/FLUX.1-dev"
RESULT_FILENAME = "flux.csv"
d... | 99 | 3,785 |
diffusers | benchmarks/benchmarking_wan.py | .py | from functools import partial
import torch
from benchmarking_utils import BenchmarkMixin, BenchmarkScenario, model_init_fn
from diffusers import WanTransformer3DModel
from diffusers.utils.testing_utils import torch_device
CKPT_ID = "Wan-AI/Wan2.1-T2V-14B-Diffusers"
RESULT_FILENAME = "wan.csv"
def get_input_dict(*... | 75 | 2,736 |
diffusers | benchmarks/benchmarking_ltx.py | .py | from functools import partial
import torch
from benchmarking_utils import BenchmarkMixin, BenchmarkScenario, model_init_fn
from diffusers import LTXVideoTransformer3DModel
from diffusers.utils.testing_utils import torch_device
CKPT_ID = "Lightricks/LTX-Video-0.9.7-dev"
RESULT_FILENAME = "ltx.csv"
def get_input_di... | 81 | 2,986 |
diffusers | benchmarks/benchmarking_sdxl.py | .py | from functools import partial
import torch
from benchmarking_utils import BenchmarkMixin, BenchmarkScenario, model_init_fn
from diffusers import UNet2DConditionModel
from diffusers.utils.testing_utils import torch_device
CKPT_ID = "stabilityai/stable-diffusion-xl-base-1.0"
RESULT_FILENAME = "sdxl.csv"
def get_inp... | 83 | 2,929 |
diffusers | docs/source/_config.py | .py | # docstyle-ignore
INSTALL_CONTENT = """
# Diffusers installation
! pip install diffusers transformers datasets accelerate
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/diffusers.git
"""
notebook_first_... | 10 | 375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.