Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit ffcf13a

Browse files
authored
Add populate feature to Player.play (#300)
* Update to ruff. * Add populate to play * Bump version. * Add typing_extensions to requirements * ignore docs in ruff. * Run ruff.
1 parent 55853e9 commit ffcf13a

29 files changed

+258
-137
lines changed

.github/workflows/coverage_and_lint.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.11", "3.x"]
18+
python-version: ["3.10", "3.x"]
1919

2020
name: "Type Coverage and Linting @ ${{ matrix.python-version }}"
2121
steps:
@@ -34,22 +34,14 @@ jobs:
3434
- name: "Install Python deps @ ${{ matrix.python-version }}"
3535
id: install-deps
3636
run: |
37-
pip install -U -r requirements.txt
37+
pip install -Ur requirements.txt
3838
- name: "Run Pyright @ ${{ matrix.python-version }}"
3939
uses: jakebailey/pyright-action@v1
4040
with:
4141
no-comments: ${{ matrix.python-version != '3.x' }}
4242
warnings: false
4343

44-
- name: Lint
44+
- name: Lint with Ruff
4545
if: ${{ always() && steps.install-deps.outcome == 'success' }}
46-
uses: github/super-linter/slim@v4
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
DEFAULT_BRANCH: main
50-
VALIDATE_ALL_CODEBASE: false
51-
VALIDATE_PYTHON_BLACK: true
52-
VALIDATE_PYTHON_ISORT: true
53-
LINTER_RULES_PATH: /
54-
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
55-
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
46+
uses: chartboost/ruff-action@v1
47+

docs/extensions/attributetable.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import importlib
44
import inspect
55
import re
6-
from enum import Enum
76
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Sequence, Tuple
87

98
from docutils import nodes

docs/extensions/details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from docutils import nodes
2-
from docutils.parsers.rst import Directive, directives, states
2+
from docutils.parsers.rst import Directive, directives
33
from docutils.parsers.rst.roles import set_classes
44

55

docs/extensions/exception_hierarchy.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from docutils import nodes
2-
from docutils.parsers.rst import Directive, directives, states
3-
from docutils.parsers.rst.roles import set_classes
4-
from sphinx.locale import _
2+
from docutils.parsers.rst import Directive
53

64

75
class exception_hierarchy(nodes.General, nodes.Element):

docs/extensions/prettyversion.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from docutils import nodes
2-
from docutils.parsers.rst import Directive, directives, states
3-
from docutils.parsers.rst.roles import set_classes
2+
from docutils.parsers.rst import Directive
43
from docutils.statemachine import StringList
5-
from sphinx.locale import _
64

75

86
class pretty_version_added(nodes.General, nodes.Element):

examples/simple.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24+
2425
import asyncio
2526
import logging
2627
from typing import cast
@@ -46,10 +47,10 @@ async def setup_hook(self) -> None:
4647
await wavelink.Pool.connect(nodes=nodes, client=self, cache_capacity=100)
4748

4849
async def on_ready(self) -> None:
49-
logging.info(f"Logged in: {self.user} | {self.user.id}")
50+
logging.info("Logged in: %s | %s", self.user, self.user.id)
5051

5152
async def on_wavelink_node_ready(self, payload: wavelink.NodeReadyEventPayload) -> None:
52-
logging.info(f"Wavelink Node connected: {payload.node!r} | Resumed: {payload.resumed}")
53+
logging.info("Wavelink Node connected: %r | Resumed: %s", payload.node, payload.resumed)
5354

5455
async def on_wavelink_track_start(self, payload: wavelink.TrackStartEventPayload) -> None:
5556
player: wavelink.Player | None = payload.player

pyproject.toml

+61-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "wavelink"
7-
version = "3.2.1"
7+
version = "3.3.0"
88
authors = [
99
{ name="PythonistaGuild, EvieePy", email="[email protected]" },
1010
]
@@ -38,14 +38,70 @@ dependencies = {file = ["requirements.txt"]}
3838
[tool.setuptools.package-data]
3939
wavelink = ["py.typed"]
4040

41-
[tool.black]
41+
[tool.ruff]
4242
line-length = 120
43+
indent-width = 4
44+
exclude = ["venv", "docs/"]
4345

44-
[tool.isort]
45-
profile = "black"
46+
[tool.ruff.lint]
47+
select = [
48+
"C4",
49+
"E",
50+
"F",
51+
"G",
52+
"I",
53+
"PTH",
54+
"RUF",
55+
"SIM",
56+
"TCH",
57+
"UP",
58+
"W",
59+
"PERF",
60+
"ANN",
61+
]
62+
ignore = [
63+
"F402",
64+
"F403",
65+
"F405",
66+
"PERF203",
67+
"RUF001",
68+
"RUF009",
69+
"SIM105",
70+
"UP034",
71+
"UP038",
72+
"ANN101",
73+
"ANN102",
74+
"ANN401",
75+
"UP031",
76+
"PTH123",
77+
"E203",
78+
"E501",
79+
"RUF006"
80+
]
81+
82+
[tool.ruff.lint.isort]
83+
split-on-trailing-comma = true
84+
combine-as-imports = true
85+
lines-after-imports = 2
86+
87+
[tool.ruff.lint.flake8-annotations]
88+
allow-star-arg-any = true
89+
90+
[tool.ruff.lint.flake8-quotes]
91+
inline-quotes = "double"
92+
93+
[tool.ruff.format]
94+
quote-style = "double"
95+
indent-style = "space"
96+
skip-magic-trailing-comma = false
97+
line-ending = "auto"
4698

4799
[tool.pyright]
100+
exclude = ["venv"]
48101
ignore = ["test*.py", "examples/*.py", "docs/*"]
49-
pythonVersion = "3.10"
102+
useLibraryCodeForTypes = true
50103
typeCheckingMode = "strict"
104+
reportImportCycles = false
51105
reportPrivateUsage = false
106+
pythonVersion = "3.10"
107+

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
aiohttp>=3.7.4,<4
22
discord.py>=2.0.1
33
yarl>=1.9.2
4-
async_timeout
4+
async_timeout
5+
typing_extensions

wavelink/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24+
2425
__title__ = "WaveLink"
2526
__author__ = "PythonistaGuild, EvieePy"
2627
__license__ = "MIT"
2728
__copyright__ = "Copyright 2019-Present (c) PythonistaGuild, EvieePy"
28-
__version__ = "3.2.1"
29+
__version__ = "3.3.0"
2930

3031

3132
from .enums import *
3233
from .exceptions import *
3334
from .filters import *
34-
from .lfu import CapacityZero as CapacityZero
35-
from .lfu import LFUCache as LFUCache
35+
from .lfu import CapacityZero as CapacityZero, LFUCache as LFUCache
3636
from .node import *
3737
from .payloads import *
3838
from .player import Player as Player

wavelink/__main__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import wavelink
77

8+
89
parser = argparse.ArgumentParser(prog="wavelink")
910
parser.add_argument("--version", action="store_true", help="Get version and debug information for wavelink.")
1011

@@ -19,7 +20,7 @@ def get_debug_info() -> None:
1920

2021
info: str = f"""
2122
wavelink: {wavelink.__version__}
22-
23+
2324
Python:
2425
- {python_info}
2526
System:

wavelink/backoff.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2222
DEALINGS IN THE SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627
import random
27-
from collections.abc import Callable
28+
from typing import TYPE_CHECKING
29+
30+
31+
if TYPE_CHECKING:
32+
from collections.abc import Callable
2833

2934

3035
class Backoff:

wavelink/enums.py

+2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24+
2425
import enum
2526

27+
2628
__all__ = ("NodeStatus", "TrackSource", "DiscordVoiceCloseType", "AutoPlayMode", "QueueMode")
2729

2830

wavelink/exceptions.py

+2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627
from typing import TYPE_CHECKING
2728

29+
2830
if TYPE_CHECKING:
2931
from .types.response import ErrorResponse, LoadedErrorPayload
3032

wavelink/filters.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,27 @@
2121
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2222
DEALINGS IN THE SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627
from typing import TYPE_CHECKING, TypedDict
2728

29+
2830
if TYPE_CHECKING:
2931
from typing_extensions import Self, Unpack
3032

31-
from .types.filters import ChannelMix as ChannelMixPayload
32-
from .types.filters import Distortion as DistortionPayload
33-
from .types.filters import Equalizer as EqualizerPayload
34-
from .types.filters import FilterPayload
35-
from .types.filters import Karaoke as KaraokePayload
36-
from .types.filters import LowPass as LowPassPayload
37-
from .types.filters import Rotation as RotationPayload
38-
from .types.filters import Timescale as TimescalePayload
39-
from .types.filters import Tremolo as TremoloPayload
40-
from .types.filters import Vibrato as VibratoPayload
33+
from .types.filters import (
34+
ChannelMix as ChannelMixPayload,
35+
Distortion as DistortionPayload,
36+
Equalizer as EqualizerPayload,
37+
FilterPayload,
38+
Karaoke as KaraokePayload,
39+
LowPass as LowPassPayload,
40+
Rotation as RotationPayload,
41+
Timescale as TimescalePayload,
42+
Tremolo as TremoloPayload,
43+
Vibrato as VibratoPayload,
44+
)
4145

4246

4347
__all__ = (

wavelink/lfu.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627
from collections import defaultdict
@@ -30,8 +31,7 @@
3031
from .exceptions import WavelinkException
3132

3233

33-
class CapacityZero(WavelinkException):
34-
...
34+
class CapacityZero(WavelinkException): ...
3535

3636

3737
class _MissingSentinel:

0 commit comments

Comments
 (0)