[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-06-11 17:52:44 +00:00
parent 0bdca1975c
commit 5c5d68d1f2
1 changed files with 18 additions and 22 deletions

View File

@ -18,7 +18,8 @@ from urllib.parse import quote
import aiohttp
import orjson as json
from discord import Client, VoiceChannel
from discord import Client
from discord import VoiceChannel
from discord.ext import commands
try:
@ -31,13 +32,7 @@ from websockets import exceptions
from . import __version__
from . import applemusic
from . import spotify
from .enums import (
TrackType,
NodeAlgorithm,
PlaylistType,
SearchType,
URLRegex
)
from .enums import TrackType, NodeAlgorithm, PlaylistType, SearchType, URLRegex
from .exceptions import InvalidSpotifyClientAuthorization
from .exceptions import LavalinkVersionIncompatible
from .exceptions import NodeConnectionFailure
@ -984,7 +979,9 @@ class NodePool:
return len(self._nodes.values())
@classmethod
def get_best_node(cls, *, algorithm: NodeAlgorithm, channel: Optional[VoiceChannel] = None) -> Node:
def get_best_node(
cls, *, algorithm: NodeAlgorithm, channel: Optional[VoiceChannel] = None,
) -> Node:
"""Fetches the best node based on an NodeAlgorithm.
This option is preferred if you want to choose the best node
from a multi-node setup using either the node's latency
@ -1019,10 +1016,9 @@ class NodePool:
if not chosen_region:
return cls.get_best_node(algorithm=NodeAlgorithm.by_ping)
if (node := next(
(node for node in available_nodes if node.location == chosen_region),
None
)):
if node := next(
(node for node in available_nodes if node.location == chosen_region), None,
):
return node
return random.choice(available_nodes)