Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ auto update by pre-commit hooks #529

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ci:
autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks'
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_tetris_stats/games/tetrio/query/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
play_time: str | None
if (game_time := handling_special_value(user_info.data.gametime)) is not None:
if game_time // 3600 > 0:
play_time = f'{game_time//3600:.0f}h {game_time % 3600 // 60:.0f}m {game_time % 60:.0f}s'
play_time = f'{game_time // 3600:.0f}h {game_time % 3600 // 60:.0f}m {game_time % 60:.0f}s'

Check warning on line 46 in nonebot_plugin_tetris_stats/games/tetrio/query/v2.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/games/tetrio/query/v2.py#L46

Added line #L46 was not covered by tests
elif game_time // 60 > 0:
play_time = f'{game_time//60:.0f}m {game_time % 60:.0f}s'
play_time = f'{game_time // 60:.0f}m {game_time % 60:.0f}s'

Check warning on line 48 in nonebot_plugin_tetris_stats/games/tetrio/query/v2.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/games/tetrio/query/v2.py#L48

Added line #L48 was not covered by tests
else:
play_time = f'{game_time:.0f}s'
else:
Expand Down
4 changes: 2 additions & 2 deletions nonebot_plugin_tetris_stats/games/tos/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@
if user_data.ranked_games == '0':
message += '暂无段位统计数据'
else:
message += f', 段位分 {round(float(user_data.rating_now),2)}±{round(float(user_data.rd_now),2)} ({round(float(user_data.vol_now),2)}) '
message += f', 段位分 {round(float(user_data.rating_now), 2)}±{round(float(user_data.rd_now), 2)} ({round(float(user_data.vol_now), 2)}) '

Check warning on line 261 in nonebot_plugin_tetris_stats/games/tos/query.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/games/tos/query.py#L261

Added line #L261 was not covered by tests
if game_data is None:
message += ', 暂无游戏数据'
else:
message += f', 最近 {game_data.game_num} 局数据'
message += f"\nL'PM: {game_data.metrics.lpm} ( {game_data.metrics.pps} pps )"
message += f'\nAPM: {game_data.metrics.apm} ( x{game_data.metrics.apl} )'
message += f'\nADPM: {game_data.metrics.adpm} ( x{game_data.metrics.adpl} ) ( {game_data.metrics.vs}vs )'
message += f'\n40L: {float(user_data.pb_sprint)/1000:.2f}s' if user_data.pb_sprint != '2147483647' else ''
message += f'\n40L: {float(user_data.pb_sprint) / 1000:.2f}s' if user_data.pb_sprint != '2147483647' else ''

Check warning on line 269 in nonebot_plugin_tetris_stats/games/tos/query.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/games/tos/query.py#L269

Added line #L269 was not covered by tests
message += f'\nMarathon: {user_data.pb_marathon}' if user_data.pb_marathon != '0' else ''
message += f'\nChallenge: {user_data.pb_challenge}' if user_data.pb_challenge != '0' else ''
return UniMessage(message)
4 changes: 3 additions & 1 deletion nonebot_plugin_tetris_stats/utils/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
nonlocal last_call
async with lock:
if (diff := (time() - last_call)) < limit_seconds:
logger.debug(f'func: {func.__name__} trigger limit, wait {(limit_time:=limit_seconds-diff):.3f}s')
logger.debug(

Check warning on line 26 in nonebot_plugin_tetris_stats/utils/limit.py

View check run for this annotation

Codecov / codecov/patch

nonebot_plugin_tetris_stats/utils/limit.py#L26

Added line #L26 was not covered by tests
f'func: {func.__name__} trigger limit, wait {(limit_time := limit_seconds - diff):.3f}s'
)
await sleep(limit_time)
last_call = time()
return await func(*args, **kwargs)
Expand Down
Loading