Remove extraneous None type annotations (#3522)

This commit is contained in:
correctmost 2025-05-28 11:52:43 +00:00 committed by GitHub
parent 52face9254
commit 26c6812827
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 10 deletions

View File

@ -104,7 +104,7 @@ class SysCommandWorker:
cmd: str | list[str],
peek_output: bool | None = False,
environment_vars: dict[str, str] | None = None,
working_directory: str | None = './',
working_directory: str = './',
remove_vt100_escape_codes_from_lines: bool = True,
):
if isinstance(cmd, str):
@ -323,7 +323,7 @@ class SysCommand:
cmd: str | list[str],
peek_output: bool | None = False,
environment_vars: dict[str, str] | None = None,
working_directory: str | None = './',
working_directory: str = './',
remove_vt100_escape_codes_from_lines: bool = True,
):
self.cmd = cmd
@ -349,7 +349,7 @@ class SysCommand:
if self.session:
yield from self.session
def __getitem__(self, key: slice) -> bytes | None:
def __getitem__(self, key: slice) -> bytes:
if not self.session:
raise KeyError('SysCommand() does not have an active session.')
elif type(key) is slice:

View File

@ -51,7 +51,7 @@ class LocaleMenu(AbstractSubMenu[LocaleConfiguration]):
),
]
def _prev_locale(self, item: MenuItem) -> str | None:
def _prev_locale(self, item: MenuItem) -> str:
temp_locale = LocaleConfiguration(
self._menu_item_group.find_by_key('kb_layout').get_value(),
self._menu_item_group.find_by_key('sys_lang').get_value(),

View File

@ -258,7 +258,7 @@ class MirrorMenu(AbstractSubMenu[MirrorConfiguration]):
),
]
def _prev_regions(self, item: MenuItem) -> str | None:
def _prev_regions(self, item: MenuItem) -> str:
regions = item.get_value()
output = ''
@ -438,7 +438,7 @@ class MirrorListHandler:
region_list = mappings[region]
return sorted(region_list, key=lambda mirror: (mirror.score, mirror.speed))
def _parse_remote_mirror_list(self, mirrorlist: str) -> dict[str, list[MirrorStatusEntryV3]] | None:
def _parse_remote_mirror_list(self, mirrorlist: str) -> dict[str, list[MirrorStatusEntryV3]]:
mirror_status = MirrorStatusListV3.model_validate_json(mirrorlist)
sorting_placeholder: dict[str, list[MirrorStatusEntryV3]] = {}
@ -472,7 +472,7 @@ class MirrorListHandler:
return sorted_by_regions
def _parse_locale_mirrors(self, mirrorlist: str) -> dict[str, list[MirrorStatusEntryV3]] | None:
def _parse_locale_mirrors(self, mirrorlist: str) -> dict[str, list[MirrorStatusEntryV3]]:
lines = mirrorlist.splitlines()
# remove empty lines

View File

@ -1369,7 +1369,7 @@ class SnapshotConfig:
return {'type': self.snapshot_type.value}
@staticmethod
def parse_args(args: _SnapshotConfigSerialization) -> SnapshotConfig | None:
def parse_args(args: _SnapshotConfigSerialization) -> SnapshotConfig:
return SnapshotConfig(SnapshotType(args['type']))

View File

@ -45,7 +45,7 @@ def _localize_path(path: Path) -> Path:
return path
def _import_via_path(path: Path, namespace: str | None = None) -> str | None:
def _import_via_path(path: Path, namespace: str | None = None) -> str:
if not namespace:
namespace = os.path.basename(path)

View File

@ -1294,7 +1294,7 @@ class Tui:
text: str,
row: int = 0,
col: int = 0,
endl: str | None = '\n',
endl: str = '\n',
clear_screen: bool = False,
) -> None:
if clear_screen: