Skip to content

Commit 72fe6f0

Browse files
style: auto fixes from pre-commit hooks
1 parent 359c640 commit 72fe6f0

27 files changed

+85
-71
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 6 additions & 5 deletions
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

Lines changed: 11 additions & 14 deletions
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

Lines changed: 6 additions & 5 deletions
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

Lines changed: 11 additions & 10 deletions
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
)
@@ -858,7 +859,7 @@ async def _handle_msg(self, data: IncomingMessage) -> None:
858859
self._ready.set()
859860
else:
860861
# Of course pyright considers this to be `Never`, so this is to keep types.
861-
op = cast(str, data["op"])
862+
op = cast("str", data["op"])
862863
_log.warn("Unknown incoming message op code %s", op)
863864

864865
async def _handle_event(self, data: EventPayload) -> None:
@@ -1268,17 +1269,17 @@ async def fetch_route_planner_status(self) -> RoutePlannerStatus | None:
12681269

12691270
if data["class"] == "RotatingIpRoutePlanner":
12701271
return RotatingIPRoutePlannerStatus(
1271-
cast(RotatingIPRouteDetails, data["details"])
1272+
cast("RotatingIPRouteDetails", data["details"])
12721273
)
12731274
elif data["class"] == "NanoIpRoutePlanner":
1274-
return NanoIPRoutePlannerStatus(cast(NanoIPRouteDetails, data["details"]))
1275+
return NanoIPRoutePlannerStatus(cast("NanoIPRouteDetails", data["details"]))
12751276
elif data["class"] == "RotatingNanoIpRoutePlanner":
12761277
return RotatingNanoIPRoutePlannerStatus(
1277-
cast(RotatingNanoIPRouteDetails, data["details"])
1278+
cast("RotatingNanoIPRouteDetails", data["details"])
12781279
)
12791280
elif data["class"] == "BalancingIpRoutePlanner":
12801281
return BalancingIPRoutePlannerStatus(
1281-
cast(BalancingIPRouteDetails, data["details"])
1282+
cast("BalancingIPRouteDetails", data["details"])
12821283
)
12831284
elif data["class"] is None:
12841285
return None

mafic/player.py

Lines changed: 6 additions & 5 deletions
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
@@ -255,7 +256,7 @@ def dispatch_event(self, data: EventPayload) -> None:
255256
track = (
256257
self._current
257258
if self.node.version == 3
258-
else Track.from_data_with_info(cast(TrackWithInfo, data.get("track")))
259+
else Track.from_data_with_info(cast("TrackWithInfo", data.get("track")))
259260
)
260261

261262
if track is None:
@@ -272,7 +273,7 @@ def dispatch_event(self, data: EventPayload) -> None:
272273
track = (
273274
self._last_track
274275
if self.node.version == 3
275-
else Track.from_data_with_info(cast(TrackWithInfo, data.get("track")))
276+
else Track.from_data_with_info(cast("TrackWithInfo", data.get("track")))
276277
)
277278

278279
if track is None:
@@ -291,7 +292,7 @@ def dispatch_event(self, data: EventPayload) -> None:
291292
track = (
292293
self._current
293294
if self.node.version == 3
294-
else Track.from_data_with_info(cast(TrackWithInfo, data.get("track")))
295+
else Track.from_data_with_info(cast("TrackWithInfo", data.get("track")))
295296
)
296297

297298
if track is None:
@@ -308,7 +309,7 @@ def dispatch_event(self, data: EventPayload) -> None:
308309
track = (
309310
self._current
310311
if self.node.version == 3
311-
else Track.from_data_with_info(cast(TrackWithInfo, data.get("track")))
312+
else Track.from_data_with_info(cast("TrackWithInfo", data.get("track")))
312313
)
313314

314315
if track is None:
@@ -324,7 +325,7 @@ def dispatch_event(self, data: EventPayload) -> None:
324325
# Pyright expects this to never happen, so do I, I really hope.
325326
# Nobody expects the Spanish Inquisition, neither does pyright.
326327

327-
event_type = cast(str, data["type"])
328+
event_type = cast("str", data["type"])
328329
_log.warning("Unknown incoming event type %s", event_type)
329330

330331
async def on_voice_state_update( # pyright: ignore[reportIncompatibleMethodOverride]

mafic/playlist.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
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

0 commit comments

Comments
 (0)