Skip to content

Commit

Permalink
refactor: remove assert statement from non-test files
Browse files Browse the repository at this point in the history
Usage of `assert` statement in application logic is discouraged. `assert` is removed with compiling to optimized byte code. Consider raising an exception instead. Ideally, `assert` statement should be used only in tests.
  • Loading branch information
deepsource-autofix[bot] authored Jan 9, 2024
1 parent 6594549 commit 384a995
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/nonebot_plugin_githubcard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ def match_link_parts(link):
async def github_handle(bot: Bot, event: GroupMessageEvent, state: T_State):
url = match_link_parts(event.get_plaintext())
imageUrl = await get_github_reposity_information(url)
assert (imageUrl != "获取信息失败")
if (imageUrl == "获取信息失败"):
raise AssertionError
await github.send(MessageSegment.image(imageUrl))

0 comments on commit 384a995

Please sign in to comment.