Skip to content

Commit

Permalink
Support older python generics syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Jc2k committed Jan 10, 2025
1 parent 9d3be4d commit 8571fbf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions music_assistant/mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import os
from collections.abc import Awaitable, Callable, Coroutine
from typing import TYPE_CHECKING, Any, Self
from typing import TYPE_CHECKING, Any, Self, TypeVar
from uuid import uuid4

import aiofiles
Expand Down Expand Up @@ -74,6 +74,8 @@
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PROVIDERS_PATH = os.path.join(BASE_DIR, "providers")

_R = TypeVar("_R")


class MusicAssistant:
"""Main MusicAssistant (Server) object."""
Expand Down Expand Up @@ -315,9 +317,9 @@ def remove_listener() -> None:

return remove_listener

def create_task[_R](
def create_task(
self,
target: Coroutine | Awaitable | Callable,
target: Coroutine[Any, Any, _R] | Awaitable[_R] | Callable[..., _R],
*args: Any,
task_id: str | None = None,
abort_existing: bool = False,
Expand Down

0 comments on commit 8571fbf

Please sign in to comment.