Skip to content

Commit 849728b

Browse files
authored
Merge pull request #188 from mathsman5133/MagicTheDev-patch-2
fix generator return typing + add clan_tag to war class
2 parents 773d140 + 49bfb5b commit 849728b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

coc/ext/fullwarapi/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ async def war_result(self, clan_tag: str, preparation_start: int = 0) -> Optiona
168168
f"/war_result?clan_tag={correct_tag(clan_tag, '%23')}"
169169
f"&prep_start={str(preparation_start)}")
170170
try:
171-
return ClanWar(data=data["response"], client=self.coc_client)
171+
return ClanWar(data=data["response"], client=self.coc_client, clan_tag=coc.utils.correct_tag(clan_tag))
172172
except (IndexError, KeyError, TypeError, ValueError):
173173
return None
174174

175-
async def war_result_log(self, clan_tag: str) -> Optional[Generator[ClanWar]]:
175+
async def war_result_log(self, clan_tag: str) -> Optional[Generator[ClanWar, None, None]]:
176176
"""Get all stored war results for a clan.
177177
178178
Parameters
@@ -189,9 +189,8 @@ async def war_result_log(self, clan_tag: str) -> Optional[Generator[ClanWar]]:
189189
f"/war_result_log?clan_tag={correct_tag(clan_tag, '%23')}")
190190
try:
191191
responses = data["log"]
192-
193-
generator = (ClanWar(data=response["response"], client=self.coc_client) for response in responses)
194-
return generator
192+
return (ClanWar(data=response["response"], client=self.coc_client,
193+
clan_tag=coc.utils.correct_tag(clan_tag)) for response in responses)
195194
except (IndexError, KeyError, TypeError, ValueError):
196195
return None
197196

0 commit comments

Comments
 (0)