Skip to content

Commit

Permalink
style: auto fixes from pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 6, 2025
1 parent da246c7 commit 5d6b4e4
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 60 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))
sys.path.append(os.path.abspath("extensions"))
from mafic import __version__ # noqa: E402
from mafic import __version__

project = "Mafic"
copyright = "2022-present, Oliver Wilkes"
Expand Down Expand Up @@ -91,7 +91,7 @@


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


intersphinx_mapping = {
Expand Down
6 changes: 3 additions & 3 deletions mafic/__libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
from .errors import MultipleCompatibleLibraries, NoCompatibleLibraries

__all__ = (
"MISSING",
"Client",
"Connectable",
"ExponentialBackoff",
"Guild",
"GuildChannel",
"GuildVoiceStatePayload",
"MISSING",
"StageChannel",
"VoiceChannel",
"VoiceProtocol",
Expand Down Expand Up @@ -120,8 +120,8 @@

if TYPE_CHECKING:
from discord.types.voice import (
GuildVoiceState as GuildVoiceStatePayload, # noqa: TCH004
VoiceServerUpdate as VoiceServerUpdatePayload, # noqa: TCH004
GuildVoiceState as GuildVoiceStatePayload, # noqa: TC004
VoiceServerUpdate as VoiceServerUpdatePayload, # noqa: TC004
)


Expand Down
1 change: 1 addition & 0 deletions mafic/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mafic CLI tools."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Errors raised by Mafic."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
11 changes: 6 additions & 5 deletions mafic/events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Objects for dispatched events via the client."""

# SPDX-License-Identifier: MIT
# pyright: reportImportCycles=false
# Player import.
Expand Down Expand Up @@ -71,7 +72,7 @@ class WebSocketClosedEvent(Generic[PlayerT]):
The player that the event was dispatched from.
"""

__slots__ = ("code", "reason", "by_discord", "player")
__slots__ = ("by_discord", "code", "player", "reason")

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

__slots__ = ("track", "player")
__slots__ = ("player", "track")

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

__slots__ = ("track", "reason", "player")
__slots__ = ("player", "reason", "track")

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

__slots__ = ("track", "exception", "player")
__slots__ = ("exception", "player", "track")

def __init__(
self,
Expand Down Expand Up @@ -190,7 +191,7 @@ class TrackStuckEvent(Generic[PlayerT]):
The player that the event was dispatched from.
"""

__slots__ = ("track", "threshold_ms", "player")
__slots__ = ("player", "threshold_ms", "track")

def __init__(
self, *, track: Track, payload: TrackStuckEventPayload, player: PlayerT
Expand Down
25 changes: 11 additions & 14 deletions mafic/filter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filters that can be applied to a Player."""

# SPDX-License-Identifier: MIT
# Reference to filter meanings can be found in:
# https://github.com/natanbc/lavadsp
Expand Down Expand Up @@ -601,26 +602,24 @@ class Filter:
"""

__slots__ = (
"channel_mix",
"distortion",
"equalizer",
"karaoke",
"low_pass",
"rotation",
"timescale",
"tremolo",
"vibrato",
"rotation",
"distortion",
"channel_mix",
"low_pass",
"volume",
)

def __init__(
self,
*,
equalizer: Equalizer
| list[tuple[int, float]]
| list[float]
| list[EQBand]
| None = None,
equalizer: (
Equalizer | list[tuple[int, float]] | list[float] | list[EQBand] | None
) = None,
karaoke: Karaoke | None = None,
timescale: Timescale | None = None,
tremolo: Tremolo | None = None,
Expand All @@ -644,11 +643,9 @@ def __init__(

def _convert_equalizer(
self,
equalizer: Equalizer
| list[tuple[int, float]]
| list[float]
| list[EQBand]
| None,
equalizer: (
Equalizer | list[tuple[int, float]] | list[float] | list[EQBand] | None
),
) -> Equalizer | None:
if equalizer is None:
return None
Expand Down
11 changes: 6 additions & 5 deletions mafic/ip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Lavalink route planner API."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand All @@ -20,12 +21,12 @@
)

__all__ = (
"IPRoutePlannerType",
"IPBlockType",
"IPBlock",
"FailingAddress",
"BaseIPRoutePlannerStatus",
"BalancingIPRoutePlannerStatus",
"BaseIPRoutePlannerStatus",
"FailingAddress",
"IPBlock",
"IPBlockType",
"IPRoutePlannerType",
"NanoIPRoutePlannerStatus",
"RotatingIPRoutePlannerStatus",
"RotatingNanoIPRoutePlannerStatus",
Expand Down
11 changes: 6 additions & 5 deletions mafic/node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node class to represent one Lavalink instance."""

# SPDX-License-Identifier: MIT
# pyright: reportImportCycles=false
# Player import.
Expand Down Expand Up @@ -178,25 +179,25 @@ class Node(Generic[ClientT]):
"_checked_version",
"_client",
"_connect_task",
"_event_queue",
"_heartbeat",
"_host",
"_label",
"_msg_tasks",
"_players",
"_port",
"_resume_key",
"_secure",
"_timeout",
"_ready",
"_rest_uri",
"_resume_key",
"_resuming_session_id",
"_secure",
"_session_id",
"_stats",
"_timeout",
"_version",
"_ws",
"_ws_uri",
"_ws_task",
"_event_queue",
"_ws_uri",
"regions",
"shard_ids",
)
Expand Down
1 change: 1 addition & 0 deletions mafic/player.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A Player is used to connect to a channel."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/playlist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The module containing :class:`Playlist`."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Lavalink plugin system."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/pool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
r"""A module containing a :class:`NodePool`, used to manage :class:`Node`\s."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/region.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A module contains region enums for voice regions and groups."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
1 change: 1 addition & 0 deletions mafic/search_type.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represents a search type for Lavalink."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
7 changes: 4 additions & 3 deletions mafic/stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A module containing classes to represent node statistics."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down Expand Up @@ -31,7 +32,7 @@ class CPUStats:
The load Lavalink is using.
"""

__slots__ = ("cores", "system_load", "lavalink_load")
__slots__ = ("cores", "lavalink_load", "system_load")

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

__slots__ = ("free", "used", "allocated", "reservable")
__slots__ = ("allocated", "free", "reservable", "used")

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

__slots__ = ("sent", "nulled", "deficit")
__slots__ = ("deficit", "nulled", "sent")

def __init__(self, payload: FrameStatsPayload) -> None:
self.sent: int = payload["sent"]
Expand Down
1 change: 1 addition & 0 deletions mafic/strategy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The strategy system for selecting a :class:`Node` from a :class:`NodePool`."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down
3 changes: 2 additions & 1 deletion mafic/track.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The module containing :class:`Track`."""

# SPDX-License-Identifier: MIT

from __future__ import annotations
Expand Down Expand Up @@ -72,8 +73,8 @@ class Track:
"""

__slots__ = (
"author",
"artwork_url",
"author",
"id",
"identifier",
"isrc",
Expand Down
1 change: 1 addition & 0 deletions mafic/type_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Type variables used in mafic."""

# SPDX-License-Identifier: MIT
# This was originally made to avoid the import cycle of
# mafic.pool -> mafic.node -> mafic.pool
Expand Down
12 changes: 6 additions & 6 deletions mafic/typings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
from typing_extensions import NotRequired

__all__ = (
"Filters",
"CPU",
"ChannelMix",
"EQBand",
"Distortion",
"EQBand",
"Filters",
"Filters",
"FrameStats",
"Karaoke",
"LowPass",
"Memory",
"Player",
"PlaylistInfo",
"Rotation",
"Stats",
"Timescale",
"TrackInfo",
"TrackWithInfo",
"Tremolo",
"Vibrato",
"VoiceState",
"VoiceStateRequest",
"Memory",
"CPU",
"FrameStats",
"Stats",
)


Expand Down
Loading

0 comments on commit 5d6b4e4

Please sign in to comment.