Update codebase to Python 3.10 using pyupgrade

This commit is contained in:
Kovid Goyal
2025-01-10 22:31:41 +05:30
parent 922d08516b
commit da1626090a
126 changed files with 1739 additions and 1764 deletions

View File

@@ -5,7 +5,7 @@ import re
import sys
from binascii import hexlify, unhexlify
from contextlib import suppress
from typing import Dict, Optional, Type, get_args
from typing import get_args
from kitty.conf.utils import OSNames, os_name
from kitty.constants import appname, str_version
@@ -52,10 +52,10 @@ class Query:
raise NotImplementedError()
all_queries: Dict[str, Type[Query]] = {}
all_queries: dict[str, type[Query]] = {}
def query(cls: Type[Query]) -> Type[Query]:
def query(cls: type[Query]) -> type[Query]:
all_queries[cls.name] = cls
return cls
@@ -237,7 +237,7 @@ class OSName(Query):
return os_name()
def get_result(name: str, window_id: int, os_window_id: int) -> Optional[str]:
def get_result(name: str, window_id: int, os_window_id: int) -> str | None:
from kitty.fast_data_types import get_options
q = all_queries.get(name)
if q is None: