fix some minor typehinting issues

This commit is contained in:
Seaswimmer 2024-09-18 12:11:04 -04:00
parent 9b7d01c402
commit f5bef8acc8
Signed by: cswimr
GPG key ID: 3813315477F26F82
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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: