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

[pre-commit.ci] pre-commit autoupdate #553

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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 @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
Expand Down
4 changes: 1 addition & 3 deletions app/api/domains/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,7 @@ async def osuSubmitModularSelector(
stats_updates["acc"] = stats.acc

# calculate new total weighted pp
weighted_pp = sum(
row["pp"] * 0.95**i for i, row in enumerate(best_scores)
)
weighted_pp = sum(row["pp"] * 0.95**i for i, row in enumerate(best_scores))
bonus_pp = 416.6667 * (1 - 0.9994 ** len(best_scores))
stats.pp = round(weighted_pp + bonus_pp)
stats_updates["pp"] = stats.pp
Expand Down
4 changes: 1 addition & 3 deletions app/api/middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ async def dispatch(
col = (
Ansi.LGREEN
if 200 <= response.status_code < 300
else Ansi.LYELLOW
if 300 <= response.status_code < 400
else Ansi.LRED
else Ansi.LYELLOW if 300 <= response.status_code < 400 else Ansi.LRED
)

url = f"{request.headers['host']}{request['path']}"
Expand Down
24 changes: 14 additions & 10 deletions app/api/v1/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ async def api_calculate_pp(

return ORJSONResponse(
# XXX: change the output type based on the inputs from user
final_results
if all(x is None for x in [ngeki, nkatu, n100, n50])
else final_results[0],
(
final_results
if all(x is None for x in [ngeki, nkatu, n100, n50])
else final_results[0]
),
status_code=status.HTTP_200_OK, # a list via the acclist parameter or a single score via n100 and n50
)

Expand Down Expand Up @@ -499,13 +501,15 @@ async def api_get_player_scores(
player_info = {
"id": player.id,
"name": player.name,
"clan": {
"id": player.clan.id,
"name": player.clan.name,
"tag": player.clan.tag,
}
if player.clan
else None,
"clan": (
{
"id": player.clan.id,
"name": player.clan.name,
"tag": player.clan.tag,
}
if player.clan
else None
),
}

return ORJSONResponse(
Expand Down
3 changes: 1 addition & 2 deletions app/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,7 @@ async def top(ctx: Context) -> str | None:
# TODO: !compare (compare to previous !last/!top post's map)


class ParsingError(str):
...
class ParsingError(str): ...


def parse__with__command_args(
Expand Down
3 changes: 1 addition & 2 deletions app/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def __repr__(self) -> str:
return f"\x1b[38;2;{self.r};{self.g};{self.b}m"


class _Rainbow:
...
class _Rainbow: ...


Rainbow = _Rainbow()
Expand Down
6 changes: 2 additions & 4 deletions app/packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,10 @@ class MultiplayerMatch:


class BasePacket(ABC):
def __init__(self, reader: BanchoPacketReader) -> None:
...
def __init__(self, reader: BanchoPacketReader) -> None: ...

@abstractmethod
async def handle(self, player: Player) -> None:
...
async def handle(self, player: Player) -> None: ...


PacketMap = dict[ClientPackets, type[BasePacket]]
Expand Down