Skip to content

Commit a7635c9

Browse files
committed
chore: update type hints and add typing-extensions dependency
1 parent 67a26df commit a7635c9

File tree

5 files changed

+14
-5
lines changed

5 files changed

+14
-5
lines changed

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies = [
1111
"ormsgpack>=1.5.0",
1212
"pydantic>=2.9.1",
1313
"httpx-ws>=0.6.2",
14+
"typing-extensions>=4.15.0",
1415
]
1516
requires-python = ">=3.9"
1617
readme = "README.md"
@@ -55,6 +56,7 @@ asyncio_mode = "auto"
5556

5657
[dependency-groups]
5758
dev = [
59+
"fish-audio-sdk[utils]",
5860
"mypy>=1.14.1",
5961
"pydoc-markdown>=4.8.2",
6062
"pytest>=8.3.5",
@@ -81,3 +83,6 @@ pages = [
8183
{title = "Utils", name="fishaudio/utils", contents = ["fishaudio.utils.*"] },
8284
{title = "Exceptions", name="fishaudio/exceptions", contents = ["fishaudio.exceptions.*"] },
8385
]
86+
87+
[tool.uv.sources]
88+
fish-audio-sdk = { workspace = true }

src/fish_audio_sdk/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
AsyncGenerator,
77
Awaitable,
88
Callable,
9-
Concatenate,
109
Generator,
1110
Generic,
12-
ParamSpec,
1311
TypeVar,
1412
)
1513

14+
from typing_extensions import Concatenate, ParamSpec
15+
1616
import httpx
1717
import httpx._client
1818
import httpx._types

src/fishaudio/utils/play.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def play(
5151
```
5252
"""
5353
# Consolidate iterator to bytes
54-
if isinstance(audio, Iterator):
54+
if not isinstance(audio, bytes):
5555
audio = b"".join(audio)
5656

5757
# Notebook mode
5858
if notebook:
5959
try:
60-
from IPython.display import Audio, display
60+
from IPython.display import Audio, display # ty: ignore[unresolved-import]
6161

6262
display(Audio(audio, rate=44100, autoplay=True))
6363
return

src/fishaudio/utils/save.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def save(audio: Union[bytes, Iterator[bytes]], filename: str) -> None:
2727
```
2828
"""
2929
# Consolidate iterator to bytes if needed
30-
if isinstance(audio, Iterator):
30+
if not isinstance(audio, bytes):
3131
audio = b"".join(audio)
3232

3333
# Write to file

uv.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)