chore: drop Optional annotation

This commit is contained in:
aclist committed 2026-11-12 05:05:59 +09:00
1 parent c267b1bbc7
commit 1dbbd5977d
2 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -9,7 +9,7 @@ import subprocess
import threading
from dataclasses import dataclass
from typing import Any, Optional, TYPE_CHECKING, Union
from typing import Any, TYPE_CHECKING, Union
from dzgui.const.constants import APP_NAME, REQUEST_TIMEOUT
from dzgui.const.endpoints import STEAM_SERVERS
@@ -491,7 +491,7 @@ def query_by_record(record: Record, update_gameport: bool = False) -> A2SInfo:
return A2SInfo(record, None)
def short_ip_to_record(addr: str) -> Optional[Record]:
def short_ip_to_record(addr: str) -> Record | None:
r = addr.split(":")
# TODO: raise exceptions instead of Nonetype
if len(r) != 2:
@@ -499,7 +499,7 @@ def short_ip_to_record(addr: str) -> Optional[Record]:
return Record(r[0], 0, int(r[1]))
def fqip_to_record(addr: str) -> Optional[Record]:
def fqip_to_record(addr: str) -> Record | None:
r = addr.split(":")
if len(r) != 3:
return None
+3 -3
View File
@@ -1,7 +1,7 @@
import gi
import logging
from typing import Any, Optional, TYPE_CHECKING
from typing import Any, TYPE_CHECKING
from dzgui.const.constants import APP_NAME, SEPARATOR
from dzgui.util.keys import is_ctrl_mask, is_navkey
@@ -19,7 +19,7 @@ if TYPE_CHECKING:
class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
def __init__(
self, controller: "Controller", menu: Optional["ContextMenuGroup"]
self, controller: "Controller", menu: "ContextMenuGroup | None"
) -> None:
super().__init__(
enable_search=False,
@@ -58,7 +58,7 @@ class TreeView(CursorMixin, Gtk.TreeView): # type: ignore
return True
return False
def get_current_iter(self) -> Optional[Gtk.TreeIter]:
def get_current_iter(self) -> Gtk.TreeIter | None:
it = self.get_selection().get_selected()[1]
return it