From f5bef8acc8c28f5f3b59d7f3ef3cff009f6d08db Mon Sep 17 00:00:00 2001 From: cswimr Date: Wed, 18 Sep 2024 12:11:04 -0400 Subject: [PATCH] fix some minor typehinting issues --- pyflowery/models.py | 4 ++-- pyflowery/pyflowery.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pyflowery/models.py b/pyflowery/models.py index 8203e7a..e5a2960 100644 --- a/pyflowery/models.py +++ b/pyflowery/models.py @@ -42,12 +42,12 @@ class Result: success (bool): Boolean of whether the request was successful status_code (int): Standard HTTP Status code message (str = ''): Human readable result - data (Union[List[Dict], Dict]): Python List of Dictionaries (or maybe just a single Dictionary on error) + data (Union[List[Dict], Dict, bytes]): Python List of Dictionaries (or maybe just a single Dictionary on error), can also be a ByteString """ success: bool status_code: int message: str = '' - data: Union[List[Dict], Dict] = field(default_factory=dict) + data: Union[List[Dict], Dict, bytes] = field(default_factory=dict) @dataclass diff --git a/pyflowery/pyflowery.py b/pyflowery/pyflowery.py index a773fd6..e32e0f9 100644 --- a/pyflowery/pyflowery.py +++ b/pyflowery/pyflowery.py @@ -90,7 +90,7 @@ class FloweryAPI: language=Language(**voice['language']), ) - async def fetch_tts(self, text: str, voice: Voice | str | None = None, translate: bool = False, silence: int = 0, audio_format: str = 'mp3', speed: float = 1.0): + async def fetch_tts(self, text: str, voice: Voice | str | None = None, translate: bool = False, silence: int = 0, audio_format: str = 'mp3', speed: float = 1.0) -> bytes: """Fetch a TTS audio file from the Flowery API Args: @@ -109,7 +109,7 @@ class FloweryAPI: RetryLimitExceeded: Raised when the retry limit defined in the `FloweryAPIConfig` class (default 3) is exceeded Returns: - bytes: The audio file + bytes: The audio file in bytes """ if len(text) > 2048: if not self.config.allow_truncation: