Fix typecheck errors in prefix disambiguation
This commit is contained in:
parent
8c83130f67
commit
37766ad69f
2 changed files with 6 additions and 3 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import logging
|
||||
from collections.abc import Awaitable, Callable
|
||||
from dataclasses import dataclass, field
|
||||
from typing import cast
|
||||
|
||||
from mudlib.player import Player
|
||||
|
||||
|
|
@ -130,7 +131,8 @@ async def dispatch(player: Player, raw_input: str) -> None:
|
|||
if len(names) == 2:
|
||||
msg = f"{names[0]} or {names[1]}?\r\n"
|
||||
else:
|
||||
msg = f"{', '.join(names[:-1])}, or {names[-1]}?\r\n"
|
||||
prefix = ", ".join(cast(list[str], names[:-1]))
|
||||
msg = f"{prefix}, or {names[-1]}?\r\n"
|
||||
player.writer.write(msg)
|
||||
await player.writer.drain()
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"""Help and command listing commands."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
from mudlib.commands import CommandDefinition, _registry, register, resolve_prefix
|
||||
from mudlib.commands.movement import DIRECTIONS
|
||||
|
|
@ -28,7 +28,8 @@ async def _show_command_detail(player: Player, command_name: str) -> None:
|
|||
if len(names) == 2:
|
||||
msg = f"{names[0]} or {names[1]}?\r\n"
|
||||
else:
|
||||
msg = f"{', '.join(names[:-1])}, or {names[-1]}?\r\n"
|
||||
prefix = ", ".join(cast(list[str], names[:-1]))
|
||||
msg = f"{prefix}, or {names[-1]}?\r\n"
|
||||
await player.send(msg)
|
||||
return
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue