Skip to content

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

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -5,28 +5,28 @@ ci:
style: auto fixes from pre-commit hooks
repos:
- repo: https://github.com/psf/black
rev: 23.12.0
rev: 25.1.0
hooks:
- id: black
name: Running black in all files.

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.8
rev: v0.12.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
name: Running ruff in all files.

- repo: https://github.com/ariebovenberg/slotscheck
rev: v0.17.1
rev: v0.19.1
hooks:
- id: slotscheck
name: Running slotscheck in all files.
exclude: "^(?!mafic/)"
additional_dependencies: [nextcord, aiohttp]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-ast
name: Check if python files are valid syntax for the ast parser
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -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"
@@ -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 = {
6 changes: 3 additions & 3 deletions mafic/__libraries.py
Original file line number Diff line number Diff line change
@@ -10,13 +10,13 @@
from .errors import MultipleCompatibleLibraries, NoCompatibleLibraries

__all__ = (
"MISSING",
"Client",
"Connectable",
"ExponentialBackoff",
"Guild",
"GuildChannel",
"GuildVoiceStatePayload",
"MISSING",
"StageChannel",
"VoiceChannel",
"VoiceProtocol",
@@ -138,8 +138,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
)


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
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
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.
@@ -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
@@ -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
@@ -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
@@ -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,
@@ -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
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
@@ -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,
@@ -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
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
@@ -20,12 +21,12 @@
)

__all__ = (
"IPRoutePlannerType",
"IPBlockType",
"IPBlock",
"FailingAddress",
"BaseIPRoutePlannerStatus",
"BalancingIPRoutePlannerStatus",
"BaseIPRoutePlannerStatus",
"FailingAddress",
"IPBlock",
"IPBlockType",
"IPRoutePlannerType",
"NanoIPRoutePlannerStatus",
"RotatingIPRoutePlannerStatus",
"RotatingNanoIPRoutePlannerStatus",
21 changes: 11 additions & 10 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.
@@ -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",
)
@@ -858,7 +859,7 @@ async def _handle_msg(self, data: IncomingMessage) -> None:
self._ready.set()
else:
# Of course pyright considers this to be `Never`, so this is to keep types.
op = cast(str, data["op"])
op = cast("str", data["op"])
_log.warn("Unknown incoming message op code %s", op)

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

if data["class"] == "RotatingIpRoutePlanner":
return RotatingIPRoutePlannerStatus(
cast(RotatingIPRouteDetails, data["details"])
cast("RotatingIPRouteDetails", data["details"])
)
elif data["class"] == "NanoIpRoutePlanner":
return NanoIPRoutePlannerStatus(cast(NanoIPRouteDetails, data["details"]))
return NanoIPRoutePlannerStatus(cast("NanoIPRouteDetails", data["details"]))
elif data["class"] == "RotatingNanoIpRoutePlanner":
return RotatingNanoIPRoutePlannerStatus(
cast(RotatingNanoIPRouteDetails, data["details"])
cast("RotatingNanoIPRouteDetails", data["details"])
)
elif data["class"] == "BalancingIpRoutePlanner":
return BalancingIPRoutePlannerStatus(
cast(BalancingIPRouteDetails, data["details"])
cast("BalancingIPRouteDetails", data["details"])
)
elif data["class"] is None:
return None
11 changes: 6 additions & 5 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
@@ -255,7 +256,7 @@ def dispatch_event(self, data: EventPayload) -> None:
track = (
self._current
if self.node.version == 3
else Track.from_data_with_info(cast(TrackWithInfo, data.get("track")))
else Track.from_data_with_info(cast("TrackWithInfo", data.get("track")))
)

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

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

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

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

event_type = cast(str, data["type"])
event_type = cast("str", data["type"])
_log.warning("Unknown incoming event type %s", event_type)

async def on_voice_state_update( # pyright: ignore[reportIncompatibleMethodOverride]
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
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
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
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
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
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.