Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fdbe09e

Browse files
committedDec 9, 2024·
style: auto fixes from pre-commit hooks
1 parent 8e65b12 commit fdbe09e

27 files changed

+74
-60
lines changed
 

‎docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# documentation root, use os.path.abspath to make it absolute, like shown here.
2323
sys.path.insert(0, os.path.abspath(".."))
2424
sys.path.append(os.path.abspath("extensions"))
25-
from mafic import __version__ # noqa: E402
25+
from mafic import __version__
2626

2727
project = "Mafic"
2828
copyright = "2022-present, Oliver Wilkes"
@@ -91,7 +91,7 @@
9191

9292

9393
def typehints_formatter(annotation: Any, _: Config) -> str | None: # noqa: ANN401
94-
return aliases.get(annotation, None)
94+
return aliases.get(annotation)
9595

9696

9797
intersphinx_mapping = {

‎mafic/__libraries.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
from .errors import MultipleCompatibleLibraries, NoCompatibleLibraries
1515

1616
__all__ = (
17+
"MISSING",
1718
"Client",
1819
"Connectable",
1920
"ExponentialBackoff",
2021
"Guild",
2122
"GuildChannel",
2223
"GuildVoiceStatePayload",
23-
"MISSING",
2424
"StageChannel",
2525
"VoiceChannel",
2626
"VoiceProtocol",
@@ -120,8 +120,8 @@
120120

121121
if TYPE_CHECKING:
122122
from discord.types.voice import (
123-
GuildVoiceState as GuildVoiceStatePayload, # noqa: TCH004
124-
VoiceServerUpdate as VoiceServerUpdatePayload, # noqa: TCH004
123+
GuildVoiceState as GuildVoiceStatePayload, # noqa: TC004
124+
VoiceServerUpdate as VoiceServerUpdatePayload, # noqa: TC004
125125
)
126126

127127

‎mafic/__main__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Mafic CLI tools."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/errors.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Errors raised by Mafic."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/events.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Objects for dispatched events via the client."""
2+
23
# SPDX-License-Identifier: MIT
34
# pyright: reportImportCycles=false
45
# Player import.
@@ -71,7 +72,7 @@ class WebSocketClosedEvent(Generic[PlayerT]):
7172
The player that the event was dispatched from.
7273
"""
7374

74-
__slots__ = ("code", "reason", "by_discord", "player")
75+
__slots__ = ("by_discord", "code", "player", "reason")
7576

7677
def __init__(
7778
self, *, payload: WebSocketClosedEventPayload, player: PlayerT
@@ -100,7 +101,7 @@ class TrackStartEvent(Generic[PlayerT]):
100101
The player that the event was dispatched from.
101102
"""
102103

103-
__slots__ = ("track", "player")
104+
__slots__ = ("player", "track")
104105

105106
def __init__(self, *, track: Track, player: PlayerT) -> None:
106107
self.track: Track = track
@@ -124,7 +125,7 @@ class TrackEndEvent(Generic[PlayerT]):
124125
The player that the event was dispatched from.
125126
"""
126127

127-
__slots__ = ("track", "reason", "player")
128+
__slots__ = ("player", "reason", "track")
128129

129130
def __init__(
130131
self, *, track: Track, payload: TrackEndEventPayload, player: PlayerT
@@ -157,7 +158,7 @@ class TrackExceptionEvent(Generic[PlayerT]):
157158
The player that the event was dispatched from.
158159
"""
159160

160-
__slots__ = ("track", "exception", "player")
161+
__slots__ = ("exception", "player", "track")
161162

162163
def __init__(
163164
self,
@@ -190,7 +191,7 @@ class TrackStuckEvent(Generic[PlayerT]):
190191
The player that the event was dispatched from.
191192
"""
192193

193-
__slots__ = ("track", "threshold_ms", "player")
194+
__slots__ = ("player", "threshold_ms", "track")
194195

195196
def __init__(
196197
self, *, track: Track, payload: TrackStuckEventPayload, player: PlayerT

‎mafic/filter.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Filters that can be applied to a Player."""
2+
23
# SPDX-License-Identifier: MIT
34
# Reference to filter meanings can be found in:
45
# https://github.com/natanbc/lavadsp
@@ -601,26 +602,24 @@ class Filter:
601602
"""
602603

603604
__slots__ = (
605+
"channel_mix",
606+
"distortion",
604607
"equalizer",
605608
"karaoke",
609+
"low_pass",
610+
"rotation",
606611
"timescale",
607612
"tremolo",
608613
"vibrato",
609-
"rotation",
610-
"distortion",
611-
"channel_mix",
612-
"low_pass",
613614
"volume",
614615
)
615616

616617
def __init__(
617618
self,
618619
*,
619-
equalizer: Equalizer
620-
| list[tuple[int, float]]
621-
| list[float]
622-
| list[EQBand]
623-
| None = None,
620+
equalizer: (
621+
Equalizer | list[tuple[int, float]] | list[float] | list[EQBand] | None
622+
) = None,
624623
karaoke: Karaoke | None = None,
625624
timescale: Timescale | None = None,
626625
tremolo: Tremolo | None = None,
@@ -644,11 +643,9 @@ def __init__(
644643

645644
def _convert_equalizer(
646645
self,
647-
equalizer: Equalizer
648-
| list[tuple[int, float]]
649-
| list[float]
650-
| list[EQBand]
651-
| None,
646+
equalizer: (
647+
Equalizer | list[tuple[int, float]] | list[float] | list[EQBand] | None
648+
),
652649
) -> Equalizer | None:
653650
if equalizer is None:
654651
return None

‎mafic/ip.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Lavalink route planner API."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations
@@ -20,12 +21,12 @@
2021
)
2122

2223
__all__ = (
23-
"IPRoutePlannerType",
24-
"IPBlockType",
25-
"IPBlock",
26-
"FailingAddress",
27-
"BaseIPRoutePlannerStatus",
2824
"BalancingIPRoutePlannerStatus",
25+
"BaseIPRoutePlannerStatus",
26+
"FailingAddress",
27+
"IPBlock",
28+
"IPBlockType",
29+
"IPRoutePlannerType",
2930
"NanoIPRoutePlannerStatus",
3031
"RotatingIPRoutePlannerStatus",
3132
"RotatingNanoIPRoutePlannerStatus",

‎mafic/node.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Node class to represent one Lavalink instance."""
2+
23
# SPDX-License-Identifier: MIT
34
# pyright: reportImportCycles=false
45
# Player import.
@@ -178,25 +179,25 @@ class Node(Generic[ClientT]):
178179
"_checked_version",
179180
"_client",
180181
"_connect_task",
182+
"_event_queue",
181183
"_heartbeat",
182184
"_host",
183185
"_label",
184186
"_msg_tasks",
185187
"_players",
186188
"_port",
187-
"_resume_key",
188-
"_secure",
189-
"_timeout",
190189
"_ready",
191190
"_rest_uri",
191+
"_resume_key",
192192
"_resuming_session_id",
193+
"_secure",
193194
"_session_id",
194195
"_stats",
196+
"_timeout",
195197
"_version",
196198
"_ws",
197-
"_ws_uri",
198199
"_ws_task",
199-
"_event_queue",
200+
"_ws_uri",
200201
"regions",
201202
"shard_ids",
202203
)

‎mafic/player.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A Player is used to connect to a channel."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/playlist.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The module containing :class:`Playlist`."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/plugin.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The Lavalink plugin system."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/pool.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
r"""A module containing a :class:`NodePool`, used to manage :class:`Node`\s."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/region.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A module contains region enums for voice regions and groups."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/search_type.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Represents a search type for Lavalink."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/stats.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A module containing classes to represent node statistics."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations
@@ -31,7 +32,7 @@ class CPUStats:
3132
The load Lavalink is using.
3233
"""
3334

34-
__slots__ = ("cores", "system_load", "lavalink_load")
35+
__slots__ = ("cores", "lavalink_load", "system_load")
3536

3637
def __init__(self, payload: CPU) -> None:
3738
self.cores: int = payload["cores"]
@@ -54,7 +55,7 @@ class MemoryStats:
5455
The amount of reservable memory for the node. Set by ``-Xmx`` for Java.
5556
"""
5657

57-
__slots__ = ("free", "used", "allocated", "reservable")
58+
__slots__ = ("allocated", "free", "reservable", "used")
5859

5960
def __init__(self, payload: Memory) -> None:
6061
self.free: int = payload["free"]
@@ -76,7 +77,7 @@ class FrameStats:
7677
The amount of frames deficit.
7778
"""
7879

79-
__slots__ = ("sent", "nulled", "deficit")
80+
__slots__ = ("deficit", "nulled", "sent")
8081

8182
def __init__(self, payload: FrameStatsPayload) -> None:
8283
self.sent: int = payload["sent"]

‎mafic/strategy.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The strategy system for selecting a :class:`Node` from a :class:`NodePool`."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/track.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The module containing :class:`Track`."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations
@@ -72,8 +73,8 @@ class Track:
7273
"""
7374

7475
__slots__ = (
75-
"author",
7676
"artwork_url",
77+
"author",
7778
"id",
7879
"identifier",
7980
"isrc",

‎mafic/type_variables.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Type variables used in mafic."""
2+
23
# SPDX-License-Identifier: MIT
34
# This was originally made to avoid the import cycle of
45
# mafic.pool -> mafic.node -> mafic.pool

‎mafic/typings/common.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010
from typing_extensions import NotRequired
1111

1212
__all__ = (
13-
"Filters",
13+
"CPU",
1414
"ChannelMix",
15-
"EQBand",
1615
"Distortion",
16+
"EQBand",
17+
"Filters",
1718
"Filters",
19+
"FrameStats",
1820
"Karaoke",
1921
"LowPass",
22+
"Memory",
2023
"Player",
2124
"PlaylistInfo",
2225
"Rotation",
26+
"Stats",
2327
"Timescale",
2428
"TrackInfo",
2529
"TrackWithInfo",
2630
"Tremolo",
2731
"Vibrato",
2832
"VoiceState",
2933
"VoiceStateRequest",
30-
"Memory",
31-
"CPU",
32-
"FrameStats",
33-
"Stats",
3434
)
3535

3636

‎mafic/typings/http.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,36 @@
1616
__all__ = (
1717
"BalancingIPRouteDetails",
1818
"BalancingIPRoutePlanner",
19+
"BalancingIPRoutePlanner",
1920
"BaseDetails",
2021
"ConfigureResumingResponse",
21-
"FailingIPAddress",
22+
"EmptyRoutePlanner",
2223
"EmptyRoutePlanner",
2324
"Error",
25+
"FailingIPAddress",
2426
"GenericTracks",
2527
"Git",
28+
"Git",
2629
"IPBlock",
2730
"Info",
31+
"Info",
2832
"NanoIPRouteDetails",
2933
"NanoIPRoutePlanner",
34+
"NanoIPRoutePlanner",
3035
"NoMatches",
3136
"PlaylistTracks",
3237
"PluginData",
3338
"RotatingIPRouteDetails",
3439
"RotatingIPRoutePlanner",
40+
"RotatingIPRoutePlanner",
3541
"RotatingNanoIPRouteDetails",
3642
"RotatingNanoIPRoutePlanner",
43+
"RotatingNanoIPRoutePlanner",
44+
"RoutePlannerStatus",
3745
"RoutePlannerStatus",
3846
"TrackLoadingResult",
3947
"TracksFailed",
4048
"Version",
41-
"Git",
42-
"Info",
43-
"RotatingIPRoutePlanner",
44-
"NanoIPRoutePlanner",
45-
"RotatingNanoIPRoutePlanner",
46-
"BalancingIPRoutePlanner",
47-
"EmptyRoutePlanner",
48-
"RoutePlannerStatus",
4949
)
5050

5151

@@ -182,8 +182,7 @@ class RotatingNanoIPRouteDetails(BaseDetails):
182182
)
183183

184184

185-
class BalancingIPRouteDetails(BaseDetails):
186-
...
185+
class BalancingIPRouteDetails(BaseDetails): ...
187186

188187

189188
BalancingIPRoutePlanner = TypedDict(

‎mafic/typings/incoming.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
__all__ = (
1818
"EventPayload",
19+
"IncomingMessage",
1920
"PlayerUpdatePayload",
2021
"PlayerUpdateState",
21-
"IncomingMessage",
2222
"TrackEndEvent",
2323
"TrackExceptionEvent",
2424
"TrackStartEvent",

‎mafic/typings/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
__all__ = (
99
"Coro",
10-
"LavalinkException",
1110
"ExceptionSeverity",
11+
"LavalinkException",
1212
"PayloadWithGuild",
1313
)
1414
T = TypeVar("T")

‎mafic/typings/outgoing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"OutgoingParams",
1414
"TrackLoadParams",
1515
"UnmarkAddressPayload",
16-
"UpdatePlayerPayload",
1716
"UpdatePlayerParams",
17+
"UpdatePlayerPayload",
1818
"UpdateSessionPayload",
1919
)
2020

‎mafic/utils/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Utilities for both Mafic users and internal uses."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from .classproperty import *

‎mafic/utils/classproperty.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Contains a decorator to merge properties and classmethods."""
2+
23
# SPDX-License-Identifier: MIT
34

45
from __future__ import annotations

‎mafic/warnings.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""Contains the warnings shown from Mafic."""
2+
23
# SPDX-License-Identifier: MIT
34

45

5-
__all__ = ("UnsupportedVersionWarning", "UnknownVersionWarning")
6+
__all__ = ("UnknownVersionWarning", "UnsupportedVersionWarning")
67

78

89
class UnsupportedVersionWarning(UserWarning):

‎test_bot/bot/__main__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def before_identify_hook(
7575
# gateway-proxy
7676
return
7777

78-
async def add_nodes(self) -> None: # noqa: PLR0912
78+
async def add_nodes(self) -> None:
7979
with open(environ["LAVALINK_FILE"], "rb") as f:
8080
data: list[LavalinkInfo] = orjson.loads(f.read())
8181

0 commit comments

Comments
 (0)
Please sign in to comment.