Skip to content

Commit

Permalink
Missing Exported Class Names
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvonthenen committed Jul 10, 2024
1 parent f294397 commit bf3ea99
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 45 deletions.
13 changes: 9 additions & 4 deletions deepgram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
ErrorResponse,
)

# live
# speect-to-text WS
from .client import LiveClient, AsyncLiveClient # backward compat
from .client import ListenWebSocketClient, AsyncListenWebSocketClient
from .client import LiveTranscriptionEvents
from .client import LiveClient, AsyncLiveClient
from .client import LiveOptions
from .client import LiveOptions, ListenWebSocketOptions
from .client import (
# OpenResponse,
LiveResultResponse,
Expand All @@ -62,8 +63,10 @@
)

# prerecorded
from .client import PreRecordedClient, AsyncPreRecordedClient
from .client import PreRecordedClient, AsyncPreRecordedClient # backward compat
from .client import ListenRESTClient, AsyncListenRESTClient
from .client import (
ListenRESTOptions,
PrerecordedOptions,
PreRecordedStreamSource,
PrerecordedSource,
Expand Down Expand Up @@ -91,6 +94,8 @@
# speak
from .client import (
SpeakOptions,
SpeakRESTOptions,
SpeakWebSocketOptions,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
Expand Down
14 changes: 12 additions & 2 deletions deepgram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@
# listen client
from .clients import Listen, Read, Speak

# live
from .clients import LiveClient, AsyncLiveClient
# speech-to-text
from .clients import LiveClient, AsyncLiveClient # backward compat
from .clients import (
ListenRESTClient,
AsyncListenRESTClient,
ListenWebSocketClient,
AsyncListenWebSocketClient,
)
from .clients import (
ListenWebSocketOptions,
LiveOptions,
LiveTranscriptionEvents,
)
Expand All @@ -57,6 +64,7 @@
AsyncPreRecordedClient,
)
from .clients import (
ListenRESTOptions,
PrerecordedOptions,
PreRecordedStreamSource,
PrerecordedSource,
Expand Down Expand Up @@ -88,6 +96,8 @@
# speak
from .clients import (
SpeakOptions,
SpeakRESTOptions,
SpeakWebSocketOptions,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
Expand Down
18 changes: 13 additions & 5 deletions deepgram/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
AsyncLiveClient,
)

# rest
# speech-to-text rest
from .listen import ListenRESTClient, AsyncListenRESTClient

## input
from .listen import (
ListenRESTOptions,
PrerecordedOptions,
PreRecordedStreamSource,
# UrlSource,
Expand All @@ -54,9 +57,12 @@
)


# websocket
# speech-to-text websocket
from .listen import ListenWebSocketClient, AsyncListenWebSocketClient

## input
from .listen import (
ListenWebSocketOptions,
LiveOptions,
)

Expand Down Expand Up @@ -93,18 +99,20 @@
SyncAnalyzeResponse,
)

# speak
# text-to-speech
## common
from .speak import (
SpeakOptions,
SpeakRESTOptions,
SpeakWebSocketOptions,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
)

from .speak import SpeakWebSocketEvents

## speak REST
## text-to-speech REST
from .speak import (
SpeakClient, # backward compat
SpeakRESTClient,
Expand All @@ -116,7 +124,7 @@
SpeakRESTResponse,
)

## speak WebSocket
## text-to-speech WebSocket
from .speak import (
SpeakWebSocketClient,
AsyncSpeakWebSocketClient,
Expand Down
4 changes: 4 additions & 0 deletions deepgram/clients/listen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# rest
## input
from .client import (
ListenRESTOptions,
PrerecordedOptions,
PreRecordedStreamSource,
UrlSource,
Expand All @@ -34,6 +35,7 @@
# websocket
## input
from .client import (
ListenWebSocketOptions,
LiveOptions,
)

Expand All @@ -51,6 +53,8 @@

# clients
from .client import (
ListenRESTClient,
AsyncListenRESTClient,
ListenWebSocketClient,
AsyncListenWebSocketClient,
)
14 changes: 12 additions & 2 deletions deepgram/clients/listen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
ListenRESTClient as ListenRESTClientLatest,
AsyncListenRESTClient as AsyncListenRESTClientLatest,
)
from .v1 import PrerecordedOptions as PrerecordedOptionsLatest
from .v1 import (
PrerecordedOptions as PrerecordedOptionsLatest,
ListenRESTOptions as ListenRESTOptionsLatest,
)

from .v1 import (
UrlSource as UrlSourceLatest,
Expand All @@ -29,7 +32,10 @@
ListenWebSocketClient as ListenWebSocketClientLatest,
AsyncListenWebSocketClient as AsyncListenWebSocketClientLatest,
)
from .v1 import LiveOptions as LiveOptionsLatest, LiveOptions as SteamingOptionsLatest
from .v1 import (
LiveOptions as LiveOptionsLatest,
ListenWebSocketOptions as ListenWebSocketOptionsLatest,
)
from .v1 import (
OpenResponse as OpenResponseLatest,
LiveResultResponse as LiveResultResponseLatest,
Expand All @@ -53,6 +59,7 @@

# rest
## input
ListenRESTOptions = ListenRESTOptionsLatest
PrerecordedOptions = PrerecordedOptionsLatest
PreRecordedStreamSource = PreRecordedStreamSourceLatest
UrlSource = UrlSourceLatest
Expand All @@ -67,6 +74,7 @@

# websocket
## input
ListenWebSocketOptions = ListenWebSocketOptionsLatest
LiveOptions = LiveOptionsLatest

## output
Expand All @@ -81,5 +89,7 @@


# clients
ListenRESTClient = ListenRESTClientLatest
AsyncListenRESTClient = AsyncListenRESTClientLatest
ListenWebSocketClient = ListenWebSocketClientLatest
AsyncListenWebSocketClient = AsyncListenWebSocketClientLatest
4 changes: 2 additions & 2 deletions deepgram/clients/listen/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# rest
from .rest import ListenRESTClient, AsyncListenRESTClient
from .rest import PrerecordedOptions
from .rest import ListenRESTOptions, PrerecordedOptions
from .rest import (
UrlSource,
FileSource,
Expand All @@ -31,7 +31,7 @@

# websocket
from .websocket import ListenWebSocketClient, AsyncListenWebSocketClient
from .websocket import LiveOptions, LiveOptions as SteamingOptions
from .websocket import LiveOptions, ListenWebSocketOptions
from .websocket import (
OpenResponse,
LiveResultResponse,
Expand Down
1 change: 1 addition & 0 deletions deepgram/clients/listen/v1/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .client import ListenRESTClient
from .async_client import AsyncListenRESTClient
from .options import (
ListenRESTOptions,
PrerecordedOptions,
FileSource,
UrlSource,
Expand Down
2 changes: 2 additions & 0 deletions deepgram/clients/listen/v1/rest/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def check(self):
return True


ListenRESTOptions = PrerecordedOptions

# PrerecordedSource for backwards compatibility
PreRecordedStreamSource = StreamSource

Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/listen/v1/websocket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .client import ListenWebSocketClient
from .async_client import AsyncListenWebSocketClient
from .options import LiveOptions
from .options import LiveOptions, ListenWebSocketOptions
from .....options import DeepgramClientOptions, ClientOptionsFromEnv
from .response import (
OpenResponse,
Expand Down
3 changes: 3 additions & 0 deletions deepgram/clients/listen/v1/websocket/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ def check(self):
logger.setLevel(prev)

return True


ListenWebSocketOptions = LiveOptions
2 changes: 2 additions & 0 deletions deepgram/clients/speak/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
)
from .client import (
SpeakOptions,
SpeakRESTOptions,
SpeakWebSocketOptions,
FileSource,
SpeakWebSocketSource,
SpeakSource,
Expand Down
4 changes: 4 additions & 0 deletions deepgram/clients/speak/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
)
from .v1 import (
SpeakOptions as SpeakOptionsLatest,
SpeakRESTOptions as SpeakRESTOptionsLatest,
SpeakWebSocketOptions as SpeakWebSocketOptionsLatest,
FileSource as FileSourceLatest,
SpeakWebSocketSource as SpeakWebSocketSourceLatest,
SpeakSource as SpeakSourceLatest,
Expand All @@ -32,6 +34,8 @@

# input
SpeakOptions = SpeakOptionsLatest
SpeakRESTOptions = SpeakRESTOptionsLatest
SpeakWebSocketOptions = SpeakWebSocketOptionsLatest
SpeakWebSocketSource = SpeakWebSocketSourceLatest
FileSource = FileSourceLatest
SpeakSource = SpeakSourceLatest
Expand Down
9 changes: 8 additions & 1 deletion deepgram/clients/speak/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .options import SpeakOptions, FileSource, SpeakWebSocketSource, SpeakSource
from .options import (
SpeakOptions,
SpeakRESTOptions,
SpeakWebSocketOptions,
FileSource,
SpeakWebSocketSource,
SpeakSource,
)
from ....options import DeepgramClientOptions, ClientOptionsFromEnv

# rest
Expand Down
18 changes: 9 additions & 9 deletions deepgram/clients/speak/v1/rest/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ...errors import DeepgramError, DeepgramTypeError

from .helpers import is_text_source
from ..options import SpeakOptions, FileSource
from ..options import SpeakRESTOptions, FileSource
from .response import SpeakRESTResponse


Expand All @@ -38,7 +38,7 @@ def __init__(self, config: DeepgramClientOptions):
async def stream(
self,
source: FileSource,
options: Optional[Union[Dict, SpeakOptions]] = None,
options: Optional[Union[Dict, SpeakRESTOptions]] = None,
addons: Optional[Dict] = None,
headers: Optional[Dict] = None,
timeout: Optional[httpx.Timeout] = None,
Expand All @@ -49,7 +49,7 @@ async def stream(
Args:
source (TextSource): The text source to speak.
options (SpeakOptions): Additional options for the ingest (default is None).
options (SpeakRESTOptions): Additional options for the ingest (default is None).
addons (Dict): Additional options for the request (default is None).
headers (Dict): Additional headers for the request (default is None).
timeout (httpx.Timeout): The timeout for the request (default is None).
Expand All @@ -71,15 +71,15 @@ async def stream(
self._logger.debug("AsyncSpeakClient.stream LEAVE")
raise DeepgramTypeError("Unknown speak source type")

if isinstance(options, SpeakOptions) and not options.check():
if isinstance(options, SpeakRESTOptions) and not options.check():
self._logger.error("options.check failed")
self._logger.debug("AsyncSpeakClient.stream LEAVE")
raise DeepgramError("Fatal speak options error")

self._logger.info("url: %s", url)
self._logger.info("source: %s", source)
if isinstance(options, SpeakOptions):
self._logger.info("SpeakOptions switching class -> dict")
if isinstance(options, SpeakRESTOptions):
self._logger.info("SpeakRESTOptions switching class -> dict")
options = options.to_dict()
self._logger.info("options: %s", options)
self._logger.info("addons: %s", addons)
Expand Down Expand Up @@ -123,7 +123,7 @@ async def file(
self,
filename: str,
source: FileSource,
options: Optional[Union[Dict, SpeakOptions]] = None,
options: Optional[Union[Dict, SpeakRESTOptions]] = None,
addons: Optional[Dict] = None,
timeout: Optional[httpx.Timeout] = None,
endpoint: str = "v1/speak",
Expand All @@ -144,7 +144,7 @@ async def save(
self,
filename: str,
source: FileSource,
options: Optional[Union[Dict, SpeakOptions]] = None,
options: Optional[Union[Dict, SpeakRESTOptions]] = None,
addons: Optional[Dict] = None,
headers: Optional[Dict] = None,
timeout: Optional[httpx.Timeout] = None,
Expand All @@ -155,7 +155,7 @@ async def save(
Args:
source (TextSource): The text source to speak.
options (SpeakOptions): Additional options for the ingest (default is None).
options (SpeakRESTOptions): Additional options for the ingest (default is None).
addons (Dict): Additional options for the request (default is None).
headers (Dict): Additional headers for the request (default is None).
timeout (httpx.Timeout): The timeout for the request (default is None).
Expand Down
Loading

0 comments on commit bf3ea99

Please sign in to comment.