Skip to content

Commit 4938ba7

Browse files
committed
mypy hello
1 parent aa6dabb commit 4938ba7

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/torchlight/Commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,7 @@ async def _func(self, message: list[str], player: Player) -> int:
15101510
for cmd in self.triggers:
15111511
if cmd == message[0]:
15121512
continue
1513-
play_cmd = cmd
1513+
play_cmd = cast(str, cmd)
15141514
break
15151515

15161516
if not play_cmd:

src/torchlight/MyInstants.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ def myinstants_get_random_sound(
4040
soup = BeautifulSoup(r.text, "html.parser")
4141

4242
buttons = soup.find_all("button", onclick=True)
43+
mp3_paths: dict[str, str] | list[str]
4344
if search_only:
44-
mp3_paths: dict[str, str] = {}
45+
mp3_paths = {}
4546
else:
46-
mp3_paths: list[str] = []
47+
mp3_paths = []
4748

4849
for btn in buttons:
4950
onclick_value = btn["onclick"]
@@ -65,9 +66,10 @@ def myinstants_get_random_sound(
6566
if not mp3_paths:
6667
return None
6768

69+
mp3_urls: str | dict[str, str]
6870
if isinstance(mp3_paths, list):
69-
mp3_urls: str = urljoin(MYINSTANTS_URL, secrets.choice(mp3_paths))
71+
mp3_urls = urljoin(MYINSTANTS_URL, secrets.choice(mp3_paths))
7072
elif isinstance(mp3_paths, dict):
71-
mp3_urls: dict[str, str] = mp3_paths
73+
mp3_urls = mp3_paths
7274

7375
return mp3_urls

0 commit comments

Comments
 (0)