Skip to content
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

Add populate feature to Player.play #300

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 5 additions & 13 deletions .github/workflows/coverage_and_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.x"]
python-version: ["3.10", "3.x"]

name: "Type Coverage and Linting @ ${{ matrix.python-version }}"
steps:
Expand All @@ -34,22 +34,14 @@ jobs:
- name: "Install Python deps @ ${{ matrix.python-version }}"
id: install-deps
run: |
pip install -U -r requirements.txt
pip install -Ur requirements.txt
- name: "Run Pyright @ ${{ matrix.python-version }}"
uses: jakebailey/pyright-action@v1
with:
no-comments: ${{ matrix.python-version != '3.x' }}
warnings: false

- name: Lint
- name: Lint with Ruff
if: ${{ always() && steps.install-deps.outcome == 'success' }}
uses: github/super-linter/slim@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main
VALIDATE_ALL_CODEBASE: false
VALIDATE_PYTHON_BLACK: true
VALIDATE_PYTHON_ISORT: true
LINTER_RULES_PATH: /
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
uses: chartboost/ruff-action@v1

1 change: 0 additions & 1 deletion docs/extensions/attributetable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import importlib
import inspect
import re
from enum import Enum
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Sequence, Tuple

from docutils import nodes
Expand Down
2 changes: 1 addition & 1 deletion docs/extensions/details.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from docutils import nodes
from docutils.parsers.rst import Directive, directives, states
from docutils.parsers.rst import Directive, directives
from docutils.parsers.rst.roles import set_classes


Expand Down
4 changes: 1 addition & 3 deletions docs/extensions/exception_hierarchy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from docutils import nodes
from docutils.parsers.rst import Directive, directives, states
from docutils.parsers.rst.roles import set_classes
from sphinx.locale import _
from docutils.parsers.rst import Directive


class exception_hierarchy(nodes.General, nodes.Element):
Expand Down
4 changes: 1 addition & 3 deletions docs/extensions/prettyversion.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from docutils import nodes
from docutils.parsers.rst import Directive, directives, states
from docutils.parsers.rst.roles import set_classes
from docutils.parsers.rst import Directive
from docutils.statemachine import StringList
from sphinx.locale import _


class pretty_version_added(nodes.General, nodes.Element):
Expand Down
5 changes: 3 additions & 2 deletions examples/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import asyncio
import logging
from typing import cast
Expand All @@ -46,10 +47,10 @@ async def setup_hook(self) -> None:
await wavelink.Pool.connect(nodes=nodes, client=self, cache_capacity=100)

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

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

async def on_wavelink_track_start(self, payload: wavelink.TrackStartEventPayload) -> None:
player: wavelink.Player | None = payload.player
Expand Down
66 changes: 61 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "wavelink"
version = "3.2.1"
version = "3.3.0"
authors = [
{ name="PythonistaGuild, EvieePy", email="[email protected]" },
]
Expand Down Expand Up @@ -38,14 +38,70 @@ dependencies = {file = ["requirements.txt"]}
[tool.setuptools.package-data]
wavelink = ["py.typed"]

[tool.black]
[tool.ruff]
line-length = 120
indent-width = 4
exclude = ["venv", "docs/"]

[tool.isort]
profile = "black"
[tool.ruff.lint]
select = [
"C4",
"E",
"F",
"G",
"I",
"PTH",
"RUF",
"SIM",
"TCH",
"UP",
"W",
"PERF",
"ANN",
]
ignore = [
"F402",
"F403",
"F405",
"PERF203",
"RUF001",
"RUF009",
"SIM105",
"UP034",
"UP038",
"ANN101",
"ANN102",
"ANN401",
"UP031",
"PTH123",
"E203",
"E501",
"RUF006"
]

[tool.ruff.lint.isort]
split-on-trailing-comma = true
combine-as-imports = true
lines-after-imports = 2

[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true

[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.pyright]
exclude = ["venv"]
ignore = ["test*.py", "examples/*.py", "docs/*"]
pythonVersion = "3.10"
useLibraryCodeForTypes = true
typeCheckingMode = "strict"
reportImportCycles = false
reportPrivateUsage = false
pythonVersion = "3.10"

3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
aiohttp>=3.7.4,<4
discord.py>=2.0.1
yarl>=1.9.2
async_timeout
async_timeout
typing_extensions
6 changes: 3 additions & 3 deletions wavelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

__title__ = "WaveLink"
__author__ = "PythonistaGuild, EvieePy"
__license__ = "MIT"
__copyright__ = "Copyright 2019-Present (c) PythonistaGuild, EvieePy"
__version__ = "3.2.1"
__version__ = "3.3.0"


from .enums import *
from .exceptions import *
from .filters import *
from .lfu import CapacityZero as CapacityZero
from .lfu import LFUCache as LFUCache
from .lfu import CapacityZero as CapacityZero, LFUCache as LFUCache
from .node import *
from .payloads import *
from .player import Player as Player
Expand Down
3 changes: 2 additions & 1 deletion wavelink/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import wavelink


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

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

info: str = f"""
wavelink: {wavelink.__version__}

Python:
- {python_info}
System:
Expand Down
7 changes: 6 additions & 1 deletion wavelink/backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

import random
from collections.abc import Callable
from typing import TYPE_CHECKING


if TYPE_CHECKING:
from collections.abc import Callable


class Backoff:
Expand Down
2 changes: 2 additions & 0 deletions wavelink/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import enum


__all__ = ("NodeStatus", "TrackSource", "DiscordVoiceCloseType", "AutoPlayMode", "QueueMode")


Expand Down
2 changes: 2 additions & 0 deletions wavelink/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from __future__ import annotations

from typing import TYPE_CHECKING


if TYPE_CHECKING:
from .types.response import ErrorResponse, LoadedErrorPayload

Expand Down
24 changes: 14 additions & 10 deletions wavelink/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
"""

from __future__ import annotations

from typing import TYPE_CHECKING, TypedDict


if TYPE_CHECKING:
from typing_extensions import Self, Unpack

from .types.filters import ChannelMix as ChannelMixPayload
from .types.filters import Distortion as DistortionPayload
from .types.filters import Equalizer as EqualizerPayload
from .types.filters import FilterPayload
from .types.filters import Karaoke as KaraokePayload
from .types.filters import LowPass as LowPassPayload
from .types.filters import Rotation as RotationPayload
from .types.filters import Timescale as TimescalePayload
from .types.filters import Tremolo as TremoloPayload
from .types.filters import Vibrato as VibratoPayload
from .types.filters import (
ChannelMix as ChannelMixPayload,
Distortion as DistortionPayload,
Equalizer as EqualizerPayload,
FilterPayload,
Karaoke as KaraokePayload,
LowPass as LowPassPayload,
Rotation as RotationPayload,
Timescale as TimescalePayload,
Tremolo as TremoloPayload,
Vibrato as VibratoPayload,
)


__all__ = (
Expand Down
4 changes: 2 additions & 2 deletions wavelink/lfu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from __future__ import annotations

from collections import defaultdict
Expand All @@ -30,8 +31,7 @@
from .exceptions import WavelinkException


class CapacityZero(WavelinkException):
...
class CapacityZero(WavelinkException): ...


class _MissingSentinel:
Expand Down
Loading
Loading