diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c1e932..514a49a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ repos: - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.2.0 hooks: - id: black args: - --diff - - --check \ No newline at end of file + - --check diff --git a/alembic/versions/1df05b897d3f_tasks.py b/alembic/versions/1df05b897d3f_tasks.py index 118aed3..49bfac7 100644 --- a/alembic/versions/1df05b897d3f_tasks.py +++ b/alembic/versions/1df05b897d3f_tasks.py @@ -5,6 +5,7 @@ Revises: a1c10da5704b Create Date: 2023-07-23 14:44:59.592519 """ + import logging from alembic import op diff --git a/alembic/versions/27aaa52f9d4a_groups.py b/alembic/versions/27aaa52f9d4a_groups.py index 83400e3..b3ae57f 100644 --- a/alembic/versions/27aaa52f9d4a_groups.py +++ b/alembic/versions/27aaa52f9d4a_groups.py @@ -5,6 +5,7 @@ Revises: c6282bc5bf67 Create Date: 2024-01-16 13:54:37.980830 """ + from alembic import op import sqlalchemy as sa import sqlmodel diff --git a/alembic/versions/89dcb9109475_tasks_daily.py b/alembic/versions/89dcb9109475_tasks_daily.py index a7e65d6..20c963c 100644 --- a/alembic/versions/89dcb9109475_tasks_daily.py +++ b/alembic/versions/89dcb9109475_tasks_daily.py @@ -5,6 +5,7 @@ Revises: 27aaa52f9d4a Create Date: 2024-03-10 10:48:10.227236 """ + from alembic import op from sqlalchemy.dialects import mysql diff --git a/alembic/versions/9e9a36470cd5_init.py b/alembic/versions/9e9a36470cd5_init.py index 2caf295..477da97 100644 --- a/alembic/versions/9e9a36470cd5_init.py +++ b/alembic/versions/9e9a36470cd5_init.py @@ -5,6 +5,7 @@ Revises: Create Date: 2022-09-01 16:55:20.372560 """ + from base64 import b64decode import sqlalchemy as sa diff --git a/alembic/versions/a1c10da5704b_devices.py b/alembic/versions/a1c10da5704b_devices.py index 022c6d4..6ca7c93 100644 --- a/alembic/versions/a1c10da5704b_devices.py +++ b/alembic/versions/a1c10da5704b_devices.py @@ -5,6 +5,7 @@ Revises: ddcfba3c7d5c Create Date: 2023-06-13 19:34:47.189846 """ + from alembic import op import sqlalchemy as sa import sqlmodel diff --git a/alembic/versions/c6282bc5bf67_devices_valid.py b/alembic/versions/c6282bc5bf67_devices_valid.py index 1e2b6f4..3ec83ed 100644 --- a/alembic/versions/c6282bc5bf67_devices_valid.py +++ b/alembic/versions/c6282bc5bf67_devices_valid.py @@ -3,6 +3,7 @@ Revision ID: c6282bc5bf67 Revises: 1df05b897d3f Create Date: 2023-10-19 14:54:35.164497 """ + from alembic import op import sqlalchemy as sa diff --git a/alembic/versions/cb37027ecae8_channel_alias.py b/alembic/versions/cb37027ecae8_channel_alias.py index cc3a125..5cf3d2d 100644 --- a/alembic/versions/cb37027ecae8_channel_alias.py +++ b/alembic/versions/cb37027ecae8_channel_alias.py @@ -3,6 +3,7 @@ Revision ID: cb37027ecae8 Revises: 89dcb9109475 Create Date: 2024-03-10 17:08:14.167818 """ + from alembic import op import sqlalchemy as sa diff --git a/alembic/versions/ddcfba3c7d5c_v4.py b/alembic/versions/ddcfba3c7d5c_v4.py index 4630a9c..1f9fbb8 100644 --- a/alembic/versions/ddcfba3c7d5c_v4.py +++ b/alembic/versions/ddcfba3c7d5c_v4.py @@ -5,6 +5,7 @@ Revises: 9e9a36470cd5 Create Date: 2023-02-11 17:07:18.170175 """ + import json import logging from base64 import b64decode diff --git a/core/error.py b/core/error.py index ce92952..79028fb 100644 --- a/core/error.py +++ b/core/error.py @@ -1,4 +1,5 @@ """此模块包含核心模块的错误的基类""" + from gram_core.error import ServiceNotFoundError __all__ = ("ServiceNotFoundError",) diff --git a/metadata/pool/pool_1.py b/metadata/pool/pool_1.py index 0595a15..8df7b1c 100644 --- a/metadata/pool/pool_1.py +++ b/metadata/pool/pool_1.py @@ -1 +1,3 @@ -POOL_1 = [{"five": ["常驻池"], "four": [], "from": "2023-04-26 06:00:00", "name": "常驻池", "to": "2050-09-15 17:59:59"}] +POOL_1 = [ + {"five": ["常驻池"], "four": [], "from": "2023-04-26 06:00:00", "name": "常驻池", "to": "2050-09-15 17:59:59"} +] diff --git a/metadata/pool/pool_2.py b/metadata/pool/pool_2.py index 3d959aa..7b7b4ef 100644 --- a/metadata/pool/pool_2.py +++ b/metadata/pool/pool_2.py @@ -1 +1,3 @@ -POOL_2 = [{"five": ["新手池"], "four": [], "from": "2023-04-26 06:00:00", "name": "新手池", "to": "2050-09-15 17:59:59"}] +POOL_2 = [ + {"five": ["新手池"], "four": [], "from": "2023-04-26 06:00:00", "name": "新手池", "to": "2050-09-15 17:59:59"} +] diff --git a/metadata/shortname.py b/metadata/shortname.py index 768b3dc..163933d 100644 --- a/metadata/shortname.py +++ b/metadata/shortname.py @@ -31,7 +31,18 @@ roles = { 1008: ["阿兰", "arlan"], 1009: ["艾丝妲", "asta", "艾斯坦", "艾斯妲", "富婆", "代理站长", "知名不具", "站长"], 1013: ["黑塔", "herta", "天才俱乐部#83", "天才俱乐部第83席", "天才俱乐部第八十三席", "黑塔女士", "转圈圈", "人偶"], - 1101: ["布洛妮娅", "bronya", "布洛妮亚", "布洛尼亚", "布洛妮娅兰德", "兰德鸭", "大板鸭", "三涡轮增鸭", "渡鸭", "鸭鸭"], + 1101: [ + "布洛妮娅", + "bronya", + "布洛妮亚", + "布洛尼亚", + "布洛妮娅兰德", + "兰德鸭", + "大板鸭", + "三涡轮增鸭", + "渡鸭", + "鸭鸭", + ], 1102: ["希儿", "seele", "蝴蝶", "希尔"], 1103: ["希露瓦", "serval", "希露瓦朗道", "朗道家长女", "贝洛伯格机械师"], 1104: ["杰帕德", "gepard", "杰帕德朗道", "杰哥", "小杰杰", "盾哥"], diff --git a/modules/apihelper/client/components/calendar.py b/modules/apihelper/client/components/calendar.py index 7f0521f..0887258 100644 --- a/modules/apihelper/client/components/calendar.py +++ b/modules/apihelper/client/components/calendar.py @@ -35,7 +35,9 @@ class Calendar: 187, # 《崩坏:星穹铁道》防沉迷系统公告 185, # 《崩坏:星穹铁道》公平运营声明 ] - IGNORE_RE = re.compile(r"(内容专题页|版本更新说明|调研|防沉迷|米游社|专项意见|游戏优化及已知问题说明|问卷调查|版本更新通知|更新时间说明|预下载功能|周边限时|周边上新|角色演示)") + IGNORE_RE = re.compile( + r"(内容专题页|版本更新说明|调研|防沉迷|米游社|专项意见|游戏优化及已知问题说明|问卷调查|版本更新通知|更新时间说明|预下载功能|周边限时|周边上新|角色演示)" + ) FULL_TIME_RE = re.compile(r"(魔神任务)") def __init__(self): @@ -61,7 +63,9 @@ class Calendar: continue content = re.sub(r'(<|<)[\w "%:;=\-\\/\\(\\),\\.]+(>|>)', "", content) try: - if reg_ret := re.search(r"(?:活动时间|祈愿介绍|任务开放时间|冒险....包|折扣时间)\s*〓([^〓]+)(〓|$)", content): + if reg_ret := re.search( + r"(?:活动时间|祈愿介绍|任务开放时间|冒险....包|折扣时间)\s*〓([^〓]+)(〓|$)", content + ): if time_ret := re.search(r"(?:活动时间)?(?:〓|\s)*([0-9\\/\\: ~]{6,})", reg_ret[1]): start_time, end_time = time_ret[1].split("~") start_time = start_time.replace("/", "-").strip() diff --git a/modules/gacha/system.py b/modules/gacha/system.py index 9b85729..d164bfd 100644 --- a/modules/gacha/system.py +++ b/modules/gacha/system.py @@ -89,7 +89,9 @@ class BannerSystem: gacha_info: PlayerGachaBannerInfo, ) -> int: # 以下是防止点炒饭 - epitomized = (banner.has_epitomized()) and (rarity == 5) and (gacha_info.wish_item_id != 0) # 判断定轨信息是否正确 + epitomized = ( + (banner.has_epitomized()) and (rarity == 5) and (gacha_info.wish_item_id != 0) + ) # 判断定轨信息是否正确 pity_epitomized = gacha_info.failed_chosen_item_pulls >= banner.wish_max_progress # 判断定轨值 pity_featured = gacha_info.get_failed_featured_item_pulls(rarity) >= 1 # 通过UP值判断当前是否为UP roll_featured = self.random_range(1, 100) <= banner.get_event_chance(rarity) # 随机判断当前是否为UP diff --git a/modules/gacha_log/log.py b/modules/gacha_log/log.py index 40c47bb..102cd08 100644 --- a/modules/gacha_log/log.py +++ b/modules/gacha_log/log.py @@ -171,9 +171,13 @@ class GachaLog: four_star = len([i for i in data if i.rank_type == "4"]) if total > 50: if total <= five_star * 15: - raise GachaLogFileError("检测到您将要导入的跃迁记录中五星数量过多,可能是由于文件错误导致的,请检查后重新导入。") + raise GachaLogFileError( + "检测到您将要导入的跃迁记录中五星数量过多,可能是由于文件错误导致的,请检查后重新导入。" + ) if four_star < five_star: - raise GachaLogFileError("检测到您将要导入的跃迁记录中五星数量过多,可能是由于文件错误导致的,请检查后重新导入。") + raise GachaLogFileError( + "检测到您将要导入的跃迁记录中五星数量过多,可能是由于文件错误导致的,请检查后重新导入。" + ) return True except Exception as exc: # pylint: disable=W0703 raise GachaLogFileError from exc diff --git a/plugins/account/account.py b/plugins/account/account.py index ff9d008..c062c05 100644 --- a/plugins/account/account.py +++ b/plugins/account/account.py @@ -111,10 +111,14 @@ class BindAccountPlugin(Plugin.Conversation): await message.reply_text("退出任务", reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END if message.text == "通过玩家ID": - await message.reply_text("请输入你的玩家ID(非通行证ID),此 ID 在 游戏客户端 左/右下角。", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "请输入你的玩家ID(非通行证ID),此 ID 在 游戏客户端 左/右下角。", reply_markup=ReplyKeyboardRemove() + ) return CHECK_PLAYER_ID if message.text == "通过账号ID": - await message.reply_text("请输入你的通行证ID(非玩家ID),此 ID 在 社区APP '我的' 页面。", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "请输入你的通行证ID(非玩家ID),此 ID 在 社区APP '我的' 页面。", reply_markup=ReplyKeyboardRemove() + ) return CHECK_ACCOUNT_ID await message.reply_text("选择错误,请重新选择") return CHECK_METHOD @@ -140,7 +144,9 @@ class BindAccountPlugin(Plugin.Conversation): await message.reply_text("用户查询次数过多,请稍后重试", reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END except CookiesCachePoolExhausted: - await message.reply_text("公共Cookies池已经耗尽,请稍后重试或者绑定 cookie", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "公共Cookies池已经耗尽,请稍后重试或者绑定 cookie", reply_markup=ReplyKeyboardRemove() + ) return ConversationHandler.END if region == RegionEnum.HYPERION: client = StarRailClient(cookies=cookies.data, region=Region.CHINESE, lang="zh-cn") @@ -174,7 +180,9 @@ class BindAccountPlugin(Plugin.Conversation): bind_account_plugin_data.account_id = account_id reply_keyboard = [["确认", "退出"]] await message.reply_text("获取角色基础信息成功,请检查是否正确!") - logger.info("用户 %s[%s] 获取账号 %s[%s] 信息成功", user.full_name, user.id, record_card.nickname, record_card.uid) + logger.info( + "用户 %s[%s] 获取账号 %s[%s] 信息成功", user.full_name, user.id, record_card.nickname, record_card.uid + ) text = ( f"*角色信息*\n" f"角色名称:{escape_markdown(record_card.nickname, version=2)}\n" @@ -238,7 +246,9 @@ class BindAccountPlugin(Plugin.Conversation): return ConversationHandler.END reply_keyboard = [["确认", "退出"]] await message.reply_text("获取角色基础信息成功,请检查是否正确!") - logger.info("用户 %s[%s] 获取账号 %s[%s] 信息成功", user.full_name, user.id, player_stats.info.nickname, player_id) + logger.info( + "用户 %s[%s] 获取账号 %s[%s] 信息成功", user.full_name, user.id, player_stats.info.nickname, player_id + ) text = ( f"*角色信息*\n" f"角色名称:{escape_markdown(player_stats.info.nickname, version=2)}\n" diff --git a/plugins/account/cookies.py b/plugins/account/cookies.py index 8e7ba2b..e40a4ac 100644 --- a/plugins/account/cookies.py +++ b/plugins/account/cookies.py @@ -236,7 +236,9 @@ class AccountCookiesPlugin(Plugin.Conversation): logger.success("用户 %s[%s] 绑定时获取 stoken 成功", user.full_name, user.id) check_cookie = True except SimnetBadRequest as exc: - logger.warning("用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original) + logger.warning( + "用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original + ) except Exception as exc: logger.error("绑定时获取新Cookie失败 [%s]", (str(exc))) finally: @@ -245,10 +247,14 @@ class AccountCookiesPlugin(Plugin.Conversation): if not check_cookie: await message.reply_text("检测到Cookie不完整,可能会出现问题。", reply_markup=ReplyKeyboardRemove()) if not cookies.stoken: - await message.reply_text("检测到缺少 stoken,请尝试添加 stoken 后重新绑定。", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "检测到缺少 stoken,请尝试添加 stoken 后重新绑定。", reply_markup=ReplyKeyboardRemove() + ) return ConversationHandler.END if cookies.stoken and cookies.stoken.startswith("v2") and cookies.mid is None: - await message.reply_text("检测到缺少 mid,请尝试添加 mid 后重新绑定。", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "检测到缺少 mid,请尝试添加 mid 后重新绑定。", reply_markup=ReplyKeyboardRemove() + ) return ConversationHandler.END try: if region == Region.CHINESE: @@ -266,9 +272,13 @@ class AccountCookiesPlugin(Plugin.Conversation): cookies.mid = cookies_model.mid cookies.ltoken = cookies_model.ltoken cookies.cookie_token = cookies_model.cookie_token - logger.success("用户 %s[%s] 绑定时获取 stoken_v2, mid, ltoken, cookie_token 成功", user.full_name, user.id) + logger.success( + "用户 %s[%s] 绑定时获取 stoken_v2, mid, ltoken, cookie_token 成功", user.full_name, user.id + ) except SimnetBadRequest as exc: - logger.warning("用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original) + logger.warning( + "用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original + ) await message.reply_text("Stoken 无效,请重新绑定。", reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END except UnicodeEncodeError: @@ -300,13 +310,17 @@ class AccountCookiesPlugin(Plugin.Conversation): except InvalidCookies: logger.info("用户 %s[%s] Cookies已经过期", user.full_name, user.id) await message.reply_text( - "获取账号信息失败,返回Cookies已经过期,请尝试在无痕浏览器中登录获取Cookies。", reply_markup=ReplyKeyboardRemove() + "获取账号信息失败,返回Cookies已经过期,请尝试在无痕浏览器中登录获取Cookies。", + reply_markup=ReplyKeyboardRemove(), ) return ConversationHandler.END except SimnetBadRequest as exc: - logger.info("用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original) + logger.info( + "用户 %s[%s] 获取账号信息发生错误 [%s]%s", user.full_name, user.id, exc.ret_code, exc.original + ) await message.reply_text( - f"获取账号信息发生错误,错误信息为 {exc.original},请检查Cookie或者账号是否正常", reply_markup=ReplyKeyboardRemove() + f"获取账号信息发生错误,错误信息为 {exc.original},请检查Cookie或者账号是否正常", + reply_markup=ReplyKeyboardRemove(), ) return ConversationHandler.END except AccountIdNotFound: @@ -344,7 +358,11 @@ class AccountCookiesPlugin(Plugin.Conversation): reply_keyboard = [["确认", "退出"]] await message.reply_text("获取角色基础信息成功,请检查是否正确!") logger.info( - "用户 %s[%s] 获取账号 %s[%s] 信息成功", user.full_name, user.id, starrail_account.nickname, starrail_account.uid + "用户 %s[%s] 获取账号 %s[%s] 信息成功", + user.full_name, + user.id, + starrail_account.nickname, + starrail_account.uid, ) text = ( f"*角色信息*\n" diff --git a/plugins/account/players.py b/plugins/account/players.py index 0f7facb..cd29503 100644 --- a/plugins/account/players.py +++ b/plugins/account/players.py @@ -43,7 +43,9 @@ class PlayersManagesPlugin(Plugin): _handle = _data[-3] _user_id = int(_data[-2]) _player_id = int(_data[-1]) - logger.debug("players_manager_callback函数返回 handle[%s] user_id[%s] player_id[%s]", _handle, _user_id, _player_id) + logger.debug( + "players_manager_callback函数返回 handle[%s] user_id[%s] player_id[%s]", _handle, _user_id, _player_id + ) return _handle, _user_id, _player_id @handler.command(command="player", filters=filters.ChatType.PRIVATE, block=False) @@ -76,7 +78,9 @@ class PlayersManagesPlugin(Plugin): ] ) if callback_query: - await callback_query.edit_message_text("从下面的列表中选择一个玩家", reply_markup=InlineKeyboardMarkup(buttons)) + await callback_query.edit_message_text( + "从下面的列表中选择一个玩家", reply_markup=InlineKeyboardMarkup(buttons) + ) else: await message.reply_text("从下面的列表中选择一个玩家", reply_markup=InlineKeyboardMarkup(buttons)) @@ -141,7 +145,8 @@ class PlayersManagesPlugin(Plugin): buttons.insert(-1, temp_buttons) await callback_query.edit_message_text( - f"这里是 {player.player_id} {player_info.nickname}\n你想用这个账号做什么?", reply_markup=InlineKeyboardMarkup(buttons) + f"这里是 {player.player_id} {player_info.nickname}\n你想用这个账号做什么?", + reply_markup=InlineKeyboardMarkup(buttons), ) @handler.callback_query(r"^players_manager\|update\|", block=False) @@ -213,7 +218,8 @@ class PlayersManagesPlugin(Plugin): cookies_data = await self.cookies_service.get(player.user_id, player.account_id, player.region) if cookies_data is None: await callback_query.edit_message_text( - f"玩家 {player.player_id} {player_info.nickname} cookies 未找到", reply_markup=InlineKeyboardMarkup(buttons) + f"玩家 {player.player_id} {player_info.nickname} cookies 未找到", + reply_markup=InlineKeyboardMarkup(buttons), ) cookies = CookiesModel(**cookies_data.data) @@ -238,11 +244,13 @@ class PlayersManagesPlugin(Plugin): cookies_data.status = CookiesStatusEnum.STATUS_SUCCESS await self.cookies_service.update(cookies_data) await callback_query.edit_message_text( - f"玩家 {player.player_id} {player_info.nickname} cookies 刷新成功", reply_markup=InlineKeyboardMarkup(buttons) + f"玩家 {player.player_id} {player_info.nickname} cookies 刷新成功", + reply_markup=InlineKeyboardMarkup(buttons), ) else: await callback_query.edit_message_text( - f"玩家 {player.player_id} {player_info.nickname} stoken 未找到", reply_markup=InlineKeyboardMarkup(buttons) + f"玩家 {player.player_id} {player_info.nickname} stoken 未找到", + reply_markup=InlineKeyboardMarkup(buttons), ) @handler.callback_query(r"^players_manager\|export_cookies\|", block=False) @@ -279,7 +287,8 @@ class PlayersManagesPlugin(Plugin): cookies_data = await self.cookies_service.get(player.user_id, player.account_id, player.region) if cookies_data is None: await callback_query.edit_message_text( - f"玩家 {player.player_id} {player_info.nickname} cookies 未找到", reply_markup=InlineKeyboardMarkup(buttons) + f"玩家 {player.player_id} {player_info.nickname} cookies 未找到", + reply_markup=InlineKeyboardMarkup(buttons), ) return device = await self.devices_service.get(player.account_id) @@ -297,7 +306,8 @@ class PlayersManagesPlugin(Plugin): f"
{html.escape(cookie_str)}
", ) await message.reply_text( - f"玩家 {player.player_id} {player_info.nickname} cookies 导出成功", reply_markup=InlineKeyboardMarkup(buttons) + f"玩家 {player.player_id} {player_info.nickname} cookies 导出成功", + reply_markup=InlineKeyboardMarkup(buttons), ) await message.delete() @@ -398,7 +408,9 @@ class PlayersManagesPlugin(Plugin): ) ], ] - await callback_query.edit_message_text("请问你真的要从Bot中删除改账号吗?", reply_markup=InlineKeyboardMarkup(buttons)) + await callback_query.edit_message_text( + "请问你真的要从Bot中删除改账号吗?", reply_markup=InlineKeyboardMarkup(buttons) + ) else: if callback_query.message: await callback_query.message.delete() diff --git a/plugins/admin/group_manage.py b/plugins/admin/group_manage.py index f3e5f43..e899dd9 100644 --- a/plugins/admin/group_manage.py +++ b/plugins/admin/group_manage.py @@ -89,7 +89,11 @@ class GroupManage(Plugin): message = update.effective_message chat_id = self.get_chat_id(context) if not callback_query else int(callback_query.data.split("|")[2]) logger.info( - "用户 %s[%s] add_block 命令请求 chat_id[%s] callback[%s]", user.full_name, user.id, chat_id, bool(callback_query) + "用户 %s[%s] add_block 命令请求 chat_id[%s] callback[%s]", + user.full_name, + user.id, + chat_id, + bool(callback_query), ) if not chat_id: await message.reply_text("参数错误,请指定群 id !") @@ -126,7 +130,11 @@ class GroupManage(Plugin): message = update.effective_message chat_id = self.get_chat_id(context) if not callback_query else int(callback_query.data.split("|")[2]) logger.info( - "用户 %s[%s] del_block 命令请求 chat_id[%s] callback[%s]", user.full_name, user.id, chat_id, bool(callback_query) + "用户 %s[%s] del_block 命令请求 chat_id[%s] callback[%s]", + user.full_name, + user.id, + chat_id, + bool(callback_query), ) if not chat_id: await message.reply_text("参数错误,请指定群 id !") diff --git a/plugins/admin/post.py b/plugins/admin/post.py index d836269..41cc1a0 100644 --- a/plugins/admin/post.py +++ b/plugins/admin/post.py @@ -382,7 +382,10 @@ class Post(Plugin.Conversation): post_handler_data: PostHandlerData = context.chat_data.get("post_handler_data") photo_len = len(post_handler_data.post_images) message = update.effective_message - await message.reply_text("请回复你要删除的图片的序列,从1开始,如果删除多张图片回复的序列请以空格作为分隔符," f"当前一共有 {photo_len} 张图片") + await message.reply_text( + "请回复你要删除的图片的序列,从1开始,如果删除多张图片回复的序列请以空格作为分隔符," + f"当前一共有 {photo_len} 张图片" + ) return GTE_DELETE_PHOTO @conversation.state(state=GTE_DELETE_PHOTO) @@ -447,7 +450,9 @@ class Post(Plugin.Conversation): @staticmethod async def add_tags(update: "Update", _: "ContextTypes.DEFAULT_TYPE") -> int: message = update.effective_message - await message.reply_text("请回复添加的tag名称,如果要添加多个tag请以空格作为分隔符,不用添加 # 作为开头,推送时程序会自动添加") + await message.reply_text( + "请回复添加的tag名称,如果要添加多个tag请以空格作为分隔符,不用添加 # 作为开头,推送时程序会自动添加" + ) return GET_TAGS @conversation.state(state=GET_TAGS) diff --git a/plugins/admin/post_code.py b/plugins/admin/post_code.py index de2e78d..29c8882 100644 --- a/plugins/admin/post_code.py +++ b/plugins/admin/post_code.py @@ -220,7 +220,9 @@ class PostCode(Plugin.Conversation): return await self.get_channel(update, context) if message.text == "推送并且定时更新": if not post_code_handler_data.real_need_update(): - await message.reply_text("所有兑换码已发放,无需创建更新任务,将直接推送。", reply_markup=ReplyKeyboardRemove()) + await message.reply_text( + "所有兑换码已发放,无需创建更新任务,将直接推送。", reply_markup=ReplyKeyboardRemove() + ) return await self.get_channel(update, context) post_code_handler_data.need_update = True await message.reply_text(post_code_handler_data.get_need_update_text()) diff --git a/plugins/app/inline.py b/plugins/app/inline.py index 92e7526..dc00c9d 100644 --- a/plugins/app/inline.py +++ b/plugins/app/inline.py @@ -149,7 +149,13 @@ class Inline(Plugin): elif args[0] == "cookies_export": return else: - if args[0] in ["查看角色攻略列表并查询", "查看角色图鉴列表并查询", "查看光锥列表并查询", "查看遗器套装列表并查询", "查看角色培养素材列表并查询"]: + if args[0] in [ + "查看角色攻略列表并查询", + "查看角色图鉴列表并查询", + "查看光锥列表并查询", + "查看遗器套装列表并查询", + "查看角色培养素材列表并查询", + ]: temp_data = { "查看角色攻略列表并查询": (self.characters_list, "角色攻略查询"), "查看角色图鉴列表并查询": (self.characters_guide_list, "角色图鉴查询"), @@ -180,7 +186,9 @@ class Inline(Plugin): title=f"当前查询内容为 {args[0]}", description="如果无查看图片描述 这是正常的 客户端问题", thumbnail_url="https://www.miyoushe.com/_nuxt/img/game-sr.4f80911.jpg", - input_message_content=InputTextMessageContent(f"当前查询内容为 {args[0]}\n如果无查看图片描述 这是正常的 客户端问题"), + input_message_content=InputTextMessageContent( + f"当前查询内容为 {args[0]}\n如果无查看图片描述 这是正常的 客户端问题" + ), ) ) for simple_search_result in simple_search_results: diff --git a/plugins/channel/channel_alias.py b/plugins/channel/channel_alias.py index 7e6b9a4..eb31cf3 100644 --- a/plugins/channel/channel_alias.py +++ b/plugins/channel/channel_alias.py @@ -26,7 +26,9 @@ CHANNEL_ALIAS_OPEN = """成功开启频道透视模式,彦卿将会把你当 - 在转让频道前,请务必关闭此功能。 """ CHANNEL_ALIAS_CLOSE = """成功关闭频道透视模式,彦卿将不会把你当做普通用户,现在你无法使用频道身份执行命令""" -CHANNEL_ADMIN_HELP = "参数错误,可用命令:\n\n- disable 关闭频道透视模式\n- change 强制设置频道透视对应的用户 id" +CHANNEL_ADMIN_HELP = ( + "参数错误,可用命令:\n\n- disable 关闭频道透视模式\n- change 强制设置频道透视对应的用户 id" +) class ChannelAliasError(Exception): diff --git a/plugins/jobs/refresh_cookies.py b/plugins/jobs/refresh_cookies.py index 85e5ba1..0a96b62 100644 --- a/plugins/jobs/refresh_cookies.py +++ b/plugins/jobs/refresh_cookies.py @@ -73,7 +73,9 @@ class RefreshCookiesJob(Plugin): if "UPDATE" in str(_exc): logger.warning("用户 user_id[%s] 刷新 Cookies 失败,数据不存在", cookie_model.user_id) else: - logger.error("用户 user_id[%s] 更新 Cookies 时出现错误", cookie_model.user_id, exc_info=_exc) + logger.error( + "用户 user_id[%s] 更新 Cookies 时出现错误", cookie_model.user_id, exc_info=_exc + ) except Exception as _exc: logger.error("用户 user_id[%s] 更新 Cookies 状态失败", cookie_model.user_id, exc_info=_exc) else: diff --git a/plugins/starrail/avatars.py b/plugins/starrail/avatars.py index ca6040c..7f7084b 100644 --- a/plugins/starrail/avatars.py +++ b/plugins/starrail/avatars.py @@ -14,7 +14,9 @@ from utils.log import logger class AvatarsPlugin(Plugin): """角色图鉴查询""" - KEYBOARD = [[InlineKeyboardButton(text="查看角色图鉴列表并查询", switch_inline_query_current_chat="查看角色图鉴列表并查询")]] + KEYBOARD = [ + [InlineKeyboardButton(text="查看角色图鉴列表并查询", switch_inline_query_current_chat="查看角色图鉴列表并查询")] + ] def __init__( self, @@ -34,7 +36,9 @@ class AvatarsPlugin(Plugin): if len(args) >= 1: character_name = args[0] else: - reply_message = await message.reply_text("请回复你要查询的图鉴的角色名", reply_markup=InlineKeyboardMarkup(self.KEYBOARD)) + reply_message = await message.reply_text( + "请回复你要查询的图鉴的角色名", reply_markup=InlineKeyboardMarkup(self.KEYBOARD) + ) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(message) self.add_delete_message_job(reply_message) diff --git a/plugins/starrail/challenge.py b/plugins/starrail/challenge.py index 96a6f1e..3b64c44 100644 --- a/plugins/starrail/challenge.py +++ b/plugins/starrail/challenge.py @@ -120,7 +120,9 @@ class ChallengePlugin(Plugin): floor, total, previous = get_args(message.text) if floor > MAX_FLOOR or floor < 0: - reply_msg = await message.reply_text(f"混沌回忆层数输入错误,请重新输入。支持的参数为: 1-{MAX_FLOOR} 或 all") + reply_msg = await message.reply_text( + f"混沌回忆层数输入错误,请重新输入。支持的参数为: 1-{MAX_FLOOR} 或 all" + ) if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_msg) self.add_delete_message_job(message) diff --git a/plugins/starrail/challenge_story.py b/plugins/starrail/challenge_story.py index 8f7ae23..c1ab06e 100644 --- a/plugins/starrail/challenge_story.py +++ b/plugins/starrail/challenge_story.py @@ -1,4 +1,5 @@ """虚构叙事数据查询""" + import asyncio import re from functools import lru_cache @@ -119,7 +120,9 @@ class ChallengeStoryPlugin(Plugin): floor, total, previous = get_args(message.text) if floor > MAX_FLOOR or floor < 0: - reply_msg = await message.reply_text(f"虚构叙事层数输入错误,请重新输入。支持的参数为: 1-{MAX_FLOOR} 或 all") + reply_msg = await message.reply_text( + f"虚构叙事层数输入错误,请重新输入。支持的参数为: 1-{MAX_FLOOR} 或 all" + ) if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_msg) self.add_delete_message_job(message) diff --git a/plugins/starrail/daily_note.py b/plugins/starrail/daily_note.py index 3912325..b491b4e 100644 --- a/plugins/starrail/daily_note.py +++ b/plugins/starrail/daily_note.py @@ -98,7 +98,9 @@ class DailyNotePlugin(Plugin): async with self.helper.genshin(user_id) as client: render_result = await self._get_daily_note(client) except DataNotPublic: - reply_message = await message.reply_text("查询失败惹,可能是便签功能被禁用了?请尝试通过米游社或者 hoyolab 获取一次便签信息后重试。") + reply_message = await message.reply_text( + "查询失败惹,可能是便签功能被禁用了?请尝试通过米游社或者 hoyolab 获取一次便签信息后重试。" + ) if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_message, delay=30) self.add_delete_message_job(message, delay=30) diff --git a/plugins/starrail/daily_note_tasks.py b/plugins/starrail/daily_note_tasks.py index e9bd4a5..6be3b04 100644 --- a/plugins/starrail/daily_note_tasks.py +++ b/plugins/starrail/daily_note_tasks.py @@ -54,7 +54,9 @@ class DailyNoteTasksPlugin(Plugin.Conversation): return ConversationHandler.END note_user = await self.note_system.get_single_task_user(user.id) url = f"{config.pass_challenge_user_web}/tasks2?command=tasks&bot_data={note_user.web_config}" - text = f'你好 {user.mention_markdown_v2()} {escape_markdown("!请点击下方按钮,开始设置,或者回复退出取消操作")}' + text = ( + f'你好 {user.mention_markdown_v2()} {escape_markdown("!请点击下方按钮,开始设置,或者回复退出取消操作")}' + ) await message.reply_markdown_v2( text, reply_markup=ReplyKeyboardMarkup.from_button( diff --git a/plugins/starrail/ledger.py b/plugins/starrail/ledger.py index 77f5a00..329cd8e 100644 --- a/plugins/starrail/ledger.py +++ b/plugins/starrail/ledger.py @@ -116,7 +116,9 @@ class LedgerPlugin(Plugin): async with self.helper.genshin(user_id) as client: render_result = await self._start_get_ledger(client, year, month) except DataNotPublic: - reply_message = await message.reply_text("查询失败惹,可能是开拓月历功能被禁用了?请先通过米游社或者 hoyolab 获取一次开拓月历后重试。") + reply_message = await message.reply_text( + "查询失败惹,可能是开拓月历功能被禁用了?请先通过米游社或者 hoyolab 获取一次开拓月历后重试。" + ) if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_message, delay=30) self.add_delete_message_job(message, delay=30) diff --git a/plugins/starrail/light_cone.py b/plugins/starrail/light_cone.py index 5c3987b..19b3416 100644 --- a/plugins/starrail/light_cone.py +++ b/plugins/starrail/light_cone.py @@ -14,7 +14,9 @@ from utils.log import logger class LightConePlugin(Plugin): """光锥图鉴查询""" - KEYBOARD = [[InlineKeyboardButton(text="查看光锥列表并查询", switch_inline_query_current_chat="查看光锥列表并查询")]] + KEYBOARD = [ + [InlineKeyboardButton(text="查看光锥列表并查询", switch_inline_query_current_chat="查看光锥列表并查询")] + ] def __init__( self, @@ -34,7 +36,9 @@ class LightConePlugin(Plugin): if len(args) >= 1: light_cone_name = args[0] else: - reply_message = await message.reply_text("请回复你要查询的光锥名称", reply_markup=InlineKeyboardMarkup(self.KEYBOARD)) + reply_message = await message.reply_text( + "请回复你要查询的光锥名称", reply_markup=InlineKeyboardMarkup(self.KEYBOARD) + ) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(message) self.add_delete_message_job(reply_message) diff --git a/plugins/starrail/relics.py b/plugins/starrail/relics.py index 24913ba..86b3654 100644 --- a/plugins/starrail/relics.py +++ b/plugins/starrail/relics.py @@ -13,7 +13,9 @@ from utils.log import logger class RelicsPlugin(Plugin): """遗器图鉴查询""" - KEYBOARD = [[InlineKeyboardButton(text="查看遗器套装列表并查询", switch_inline_query_current_chat="查看遗器套装列表并查询")]] + KEYBOARD = [ + [InlineKeyboardButton(text="查看遗器套装列表并查询", switch_inline_query_current_chat="查看遗器套装列表并查询")] + ] def __init__( self, @@ -33,7 +35,9 @@ class RelicsPlugin(Plugin): if len(args) >= 1: relics_name = args[0] else: - reply_message = await message.reply_text("请回复你要查询的遗器名称", reply_markup=InlineKeyboardMarkup(self.KEYBOARD)) + reply_message = await message.reply_text( + "请回复你要查询的遗器名称", reply_markup=InlineKeyboardMarkup(self.KEYBOARD) + ) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(message) self.add_delete_message_job(reply_message) diff --git a/plugins/starrail/role_detail.py b/plugins/starrail/role_detail.py index b5b3acf..de2dae6 100644 --- a/plugins/starrail/role_detail.py +++ b/plugins/starrail/role_detail.py @@ -492,7 +492,13 @@ class RoleDetailPlugin(Plugin.Conversation): uid = int(args[0].split("_")[3]) char_id = int(args[0].split("_")[4]) char_name = idToRole(char_id) - logger.info("用户 %s[%s] 通过start命令 进入设置遗器副属性自定义流程 uid[%s] char_id[%s]", user.full_name, user.id, uid, char_id) + logger.info( + "用户 %s[%s] 通过start命令 进入设置遗器副属性自定义流程 uid[%s] char_id[%s]", + user.full_name, + user.id, + uid, + char_id, + ) try: nickname, data = await self.get_characters(uid) except NeedClient: diff --git a/plugins/starrail/sign.py b/plugins/starrail/sign.py index 71537f6..17ad82b 100644 --- a/plugins/starrail/sign.py +++ b/plugins/starrail/sign.py @@ -115,7 +115,9 @@ class Sign(Plugin): not filters.ChatType.PRIVATE.filter(message), ) reply_message = await message.reply_text( - "签到失败,触发验证码风控,请尝试点击下方按钮重新签到", allow_sending_without_reply=True, reply_markup=button + "签到失败,触发验证码风控,请尝试点击下方按钮重新签到", + allow_sending_without_reply=True, + reply_markup=button, ) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(reply_message) diff --git a/plugins/starrail/strategy.py b/plugins/starrail/strategy.py index 3586a75..c55eaae 100644 --- a/plugins/starrail/strategy.py +++ b/plugins/starrail/strategy.py @@ -14,7 +14,9 @@ from utils.log import logger class StrategyPlugin(Plugin): """角色攻略查询""" - KEYBOARD = [[InlineKeyboardButton(text="查看角色攻略列表并查询", switch_inline_query_current_chat="查看角色攻略列表并查询")]] + KEYBOARD = [ + [InlineKeyboardButton(text="查看角色攻略列表并查询", switch_inline_query_current_chat="查看角色攻略列表并查询")] + ] def __init__( self, @@ -34,7 +36,9 @@ class StrategyPlugin(Plugin): if len(args) >= 1: character_name = args[0] else: - reply_message = await message.reply_text("请回复你要查询的攻略的角色名", reply_markup=InlineKeyboardMarkup(self.KEYBOARD)) + reply_message = await message.reply_text( + "请回复你要查询的攻略的角色名", reply_markup=InlineKeyboardMarkup(self.KEYBOARD) + ) if filters.ChatType.GROUPS.filter(reply_message): self.add_delete_message_job(message) self.add_delete_message_job(reply_message) diff --git a/plugins/starrail/wish_log.py b/plugins/starrail/wish_log.py index cf8f7f5..61ecfa1 100644 --- a/plugins/starrail/wish_log.py +++ b/plugins/starrail/wish_log.py @@ -213,7 +213,9 @@ class WishLogPlugin(Plugin.Conversation): if not status: await message.reply_text("你还没有导入跃迁记录哦~") return ConversationHandler.END - await message.reply_text("你确定要删除跃迁记录吗?(此项操作无法恢复),如果确定请发送 ”确定“,发送其他内容取消") + await message.reply_text( + "你确定要删除跃迁记录吗?(此项操作无法恢复),如果确定请发送 ”确定“,发送其他内容取消" + ) return CONFIRM_DELETE @conversation.state(state=CONFIRM_DELETE) @@ -270,7 +272,9 @@ class WishLogPlugin(Plugin.Conversation): buttons = [ [InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "warp_log_import"))] ] - await message.reply_text("彦卿没有找到你的跃迁记录,快来私聊彦卿导入吧~", reply_markup=InlineKeyboardMarkup(buttons)) + await message.reply_text( + "彦卿没有找到你的跃迁记录,快来私聊彦卿导入吧~", reply_markup=InlineKeyboardMarkup(buttons) + ) except GachaLogAccountNotFound: await message.reply_text("导入失败,可能文件包含的跃迁记录所属 uid 与你当前绑定的 uid 不同") except GachaLogFileError: @@ -382,7 +386,10 @@ class WishLogPlugin(Plugin.Conversation): buttons = [ [InlineKeyboardButton("点我导入", url=create_deep_linked_url(context.bot.username, "warp_log_import"))] ] - await message.reply_text("彦卿没有找到你此卡池的跃迁记录,快来点击按钮私聊彦卿导入吧~", reply_markup=InlineKeyboardMarkup(buttons)) + await message.reply_text( + "彦卿没有找到你此卡池的跃迁记录,快来点击按钮私聊彦卿导入吧~", + reply_markup=InlineKeyboardMarkup(buttons), + ) @handler.callback_query(pattern=r"^get_wish_log\|", block=False) async def get_wish_log(self, update: "Update", _: "ContextTypes.DEFAULT_TYPE") -> None: diff --git a/plugins/system/errorhandler.py b/plugins/system/errorhandler.py index 0cf4fc6..fb42320 100644 --- a/plugins/system/errorhandler.py +++ b/plugins/system/errorhandler.py @@ -77,7 +77,9 @@ class ErrorHandler(Plugin): buttons = InlineKeyboardMarkup( [ [ - InlineKeyboardButton("点我重新绑定", url=create_deep_linked_url(context.bot.username, "set_cookie")), + InlineKeyboardButton( + "点我重新绑定", url=create_deep_linked_url(context.bot.username, "set_cookie") + ), _import_button, ], ] @@ -147,7 +149,10 @@ class ErrorHandler(Plugin): if exc.retcode in (10001, -100): notice = self.ERROR_MSG_PREFIX + "Cookie 无效,请尝试重新绑定" elif exc.retcode == 10103: - notice = self.ERROR_MSG_PREFIX + "Cookie 有效,但没有绑定到游戏帐户,请尝试登录通行证,在账号管理里面选择账号游戏信息,将星穹铁道设置为默认角色。" + notice = ( + self.ERROR_MSG_PREFIX + + "Cookie 有效,但没有绑定到游戏帐户,请尝试登录通行证,在账号管理里面选择账号游戏信息,将星穹铁道设置为默认角色。" + ) else: logger.error("未知Cookie错误", exc_info=exc) notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定" @@ -228,9 +233,15 @@ class ErrorHandler(Plugin): if isinstance(exc, APIHelperTimedOut): notice = self.ERROR_MSG_PREFIX + " 服务器熟啦 ~ 请稍后再试" elif isinstance(exc, ReturnCodeError): - notice = self.ERROR_MSG_PREFIX + f"API请求错误 错误信息为 {exc.message if exc.message else exc.code} ~ 请稍后再试" + notice = ( + self.ERROR_MSG_PREFIX + + f"API请求错误 错误信息为 {exc.message if exc.message else exc.code} ~ 请稍后再试" + ) elif isinstance(exc, ResponseException): - notice = self.ERROR_MSG_PREFIX + f"API请求错误 错误信息为 {exc.message if exc.message else exc.code} ~ 请稍后再试" + notice = ( + self.ERROR_MSG_PREFIX + + f"API请求错误 错误信息为 {exc.message if exc.message else exc.code} ~ 请稍后再试" + ) if notice: self.create_notice_task(update, context, notice) raise ApplicationHandlerStop diff --git a/plugins/tools/daily_note.py b/plugins/tools/daily_note.py index f23080b..f27bf00 100644 --- a/plugins/tools/daily_note.py +++ b/plugins/tools/daily_note.py @@ -184,7 +184,8 @@ class DailyNoteSystem(Plugin): if now_hour == user.daily.notice_hour: if notes.current_train_score != notes.max_train_score and (not user.daily.noticed): notice = ( - f"### 每日任务提示 ####\n\n" f"当前进度为 {notes.current_train_score} / {notes.max_train_score} ,记得完成哦~" + f"### 每日任务提示 ####\n\n" + f"当前进度为 {notes.current_train_score} / {notes.max_train_score} ,记得完成哦~" ) user.daily.noticed = True else: diff --git a/plugins/tools/sign.py b/plugins/tools/sign.py index 8c9519d..59d80f5 100644 --- a/plugins/tools/sign.py +++ b/plugins/tools/sign.py @@ -135,7 +135,9 @@ class SignSystem(Plugin): if not daily_reward_info.signed_in: try: if validate: - logger.info("UID[%s] 正在尝试通过验证码\nchallenge[%s]\nvalidate[%s]", client.player_id, challenge, validate) + logger.info( + "UID[%s] 正在尝试通过验证码\nchallenge[%s]\nvalidate[%s]", client.player_id, challenge, validate + ) request_daily_reward = await client.request_daily_reward( "sign", method="POST", @@ -191,7 +193,9 @@ class SignSystem(Plugin): logger.info("UID[%s] 创建验证码\ngt[%s]\nchallenge[%s]", client.player_id, _gt, _challenge) _validate = await RecognizeSystem.recognize(_gt, _challenge, uid=client.player_id) if _validate: - logger.success("recognize 通过验证成功\nchallenge[%s]\nvalidate[%s]", _challenge, _validate) + logger.success( + "recognize 通过验证成功\nchallenge[%s]\nvalidate[%s]", _challenge, _validate + ) request_daily_reward = await client.request_daily_reward( "sign", method="POST", @@ -219,7 +223,9 @@ class SignSystem(Plugin): ) gt = request_daily_reward.get("gt", "") challenge = request_daily_reward.get("challenge", "") - logger.success("UID[%s] 创建验证成功\ngt[%s]\nchallenge[%s]", client.player_id, gt, challenge) + logger.success( + "UID[%s] 创建验证成功\ngt[%s]\nchallenge[%s]", client.player_id, gt, challenge + ) raise NeedChallenge(uid=client.player_id, gt=gt, challenge=challenge) else: request_daily_reward = await client.request_daily_reward( diff --git a/utils/const/__init__.py b/utils/const/__init__.py index cedd98b..dd36cf4 100644 --- a/utils/const/__init__.py +++ b/utils/const/__init__.py @@ -1,4 +1,5 @@ """一些常量""" + from functools import WRAPPER_ASSIGNMENTS as _WRAPPER_ASSIGNMENTS from typing import List diff --git a/utils/const/_path.py b/utils/const/_path.py index f7fc95a..ad2e716 100644 --- a/utils/const/_path.py +++ b/utils/const/_path.py @@ -1,4 +1,5 @@ """目录常量""" + from pathlib import Path __all__ = ["PROJECT_ROOT", "CORE_DIR", "PLUGIN_DIR", "RESOURCE_DIR", "CACHE_DIR"] diff --git a/utils/log/_traceback.py b/utils/log/_traceback.py index 7ef9c34..35cf1e8 100644 --- a/utils/log/_traceback.py +++ b/utils/log/_traceback.py @@ -198,17 +198,19 @@ class Traceback(BaseTraceback): filename=filename or "?", lineno=line_no, name=frame_summary.f_code.co_name, - locals={ - key: pretty.traverse( - Traceback.filter_value(value), - max_length=locals_max_length, - max_string=locals_max_string, - max_depth=locals_max_depth, - ) - for key, value in frame_summary.f_locals.items() - } - if show_locals - else None, + locals=( + { + key: pretty.traverse( + Traceback.filter_value(value), + max_length=locals_max_length, + max_string=locals_max_string, + max_depth=locals_max_depth, + ) + for key, value in frame_summary.f_locals.items() + } + if show_locals + else None + ), ) append(frame) if frame_summary.f_locals.get("_rich_traceback_guard", False):