mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 22:44:50 +02:00
Run pyupgrade to update the codebase to python 3.9
Gets rid of a lot of typing ugliness by using type annotations on builtin types
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from collections.abc import Iterator, Mapping, Sequence
|
||||
from enum import Enum
|
||||
from functools import update_wrapper
|
||||
from typing import TYPE_CHECKING, Any, Callable, Dict, Generic, Iterator, Mapping, NamedTuple, Optional, Sequence, Tuple, TypedDict, TypeVar, Union
|
||||
from typing import TYPE_CHECKING, Any, Callable, Generic, NamedTuple, Optional, TypedDict, TypeVar, Union
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from kitty.fast_data_types import SingleKey
|
||||
@@ -95,7 +96,7 @@ def human_repr_of_single_key(self: 'SingleKey', kitty_mod: int) -> str:
|
||||
|
||||
|
||||
class Shortcut(NamedTuple):
|
||||
keys: Tuple['SingleKey', ...]
|
||||
keys: tuple['SingleKey', ...]
|
||||
|
||||
def human_repr(self, kitty_mod: int = 0) -> str:
|
||||
return ' > '.join(human_repr_of_single_key(k, kitty_mod) for k in self.keys)
|
||||
@@ -182,7 +183,7 @@ def run_once(f: Callable[[], _T]) -> 'RunOnce[_T]':
|
||||
|
||||
|
||||
@run_once
|
||||
def modmap() -> Dict[str, int]:
|
||||
def modmap() -> dict[str, int]:
|
||||
from .constants import is_macos
|
||||
from .fast_data_types import (
|
||||
GLFW_MOD_ALT,
|
||||
|
||||
Reference in New Issue
Block a user