Skip to content

Commit

Permalink
refactor: use identity check for comparison to a singleton (#28)
Browse files Browse the repository at this point in the history
Comparisons to the singleton objects, like `True`, `False`, and `None`, should be done with identity, not equality. Use `is` or `is not`.

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Jan 9, 2024
1 parent 32b9f00 commit 7d62c5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/plugins/nonebot_plugin_addFriend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def _(bot: Bot, event: RequestEvent):
# 黑名单警告,转发给设定的人
await sendMsg(bot, config[bot.self_id]['recipientList'], msg+status, 0)
forwardId = config[bot.self_id]["blackDict"]["forward"].get(id)
if forwardId != None and autoType == "group":
if forwardId is not None and autoType == "group":
friendList = await getReferIdList(bot, 'user_id')
if forwardId in friendList:
await bot.send_private_msg(user_id=forwardId, message=msg+status)
Expand Down Expand Up @@ -226,7 +226,7 @@ async def _(bot: Bot, event: MessageEvent, args: Message = CommandArg()):
# 预处理完毕,开始设置参数
QQOrGroupId = argsText.split()[0]
print(QQOrGroupId)
if requestorDict[bot.self_id][autoType].get(QQOrGroupId) == None:
if requestorDict[bot.self_id][autoType].get(QQOrGroupId) is None:
await addFriend.finish('没有此请求')

flag = requestorDict[bot.self_id][autoType][QQOrGroupId]['flag']
Expand Down Expand Up @@ -255,7 +255,7 @@ async def _(bot: Bot, event: MessageEvent, args: Message = CommandArg()):
if int(QQOrGroupId) in friendList:
status = '已经添加成功,勿复添加'
else:
if len(argsText) >= 2 and argsText[1] != '' and approve == True:
if len(argsText) >= 2 and argsText[1] != '' and approve is True:
remark = argsText[1]
# 备注似乎无用
await bot.set_friend_add_request(flag=flag, approve=approve, remark=remark)
Expand Down

0 comments on commit 7d62c5b

Please sign in to comment.