Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deepgram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
PrerecordedSource,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
PrerecordedOptions,
Sentiment,
)
Expand All @@ -49,7 +49,7 @@
TextSource,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
AnalyzeOptions,
Sentiment,
)
Expand Down
4 changes: 2 additions & 2 deletions deepgram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
PrerecordedSource,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
PrerecordedOptions,
Sentiment,
)
Expand All @@ -52,7 +52,7 @@
TextSource,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
AnalyzeOptions,
Sentiment,
)
Expand Down
4 changes: 2 additions & 2 deletions deepgram/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
PrerecordedSource,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
)
from .prerecorded import (
AsyncPrerecordedResponse,
Expand All @@ -44,7 +44,7 @@
TextSource,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
)
from .analyze import (
AsyncAnalyzeResponse,
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/analyze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .client import (
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
AnalyzeSource,
TextSource,
)
Expand Down
6 changes: 3 additions & 3 deletions deepgram/clients/analyze/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .v1.async_client import AsyncAnalyzeClient as AsyncAnalyzeClientLatest
from .v1.options import (
AnalyzeOptions as AnalyzeOptionsLatest,
StreamSource as StreamSourceLatest,
AnalyzeStreamSource as AnalyzeStreamSourceLatest,
BufferSource as BufferSourceLatest,
UrlSource as UrlSourceLatest,
AnalyzeSource as AnalyzeSourceLatest,
Expand Down Expand Up @@ -36,9 +36,9 @@ class AnalyzeOptions(AnalyzeOptionsLatest):
pass


class StreamSource(StreamSourceLatest):
class AnalyzeStreamSource(AnalyzeStreamSourceLatest):
"""
Please see StreamSourceLatest for details
Please see AnalyzeStreamSourceLatest for details
"""

pass
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/analyze/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
AnalyzeOptions,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
TextSource,
AnalyzeSource,
)
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/analyze/v1/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
AnalyzeOptions,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
TextSource,
AnalyzeSource,
)
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/analyze/v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
AnalyzeOptions,
UrlSource,
BufferSource,
StreamSource,
AnalyzeStreamSource,
TextSource,
AnalyzeSource,
)
Expand Down
53 changes: 9 additions & 44 deletions deepgram/clients/analyze/v1/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from io import BufferedReader
from typing import Union, Optional
from typing_extensions import TypedDict
import logging, verboselogs


Expand Down Expand Up @@ -78,9 +79,7 @@ def check(self):
return True


@dataclass_json
@dataclass
class StreamSource:
class AnalyzeStreamSource(TypedDict):
"""
Represents a data source for reading binary data from a stream-like source.

Expand All @@ -91,22 +90,10 @@ class StreamSource:
stream (BufferedReader): A BufferedReader object for reading binary data.
"""

stream: BufferedReader = None

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val

def __str__(self) -> str:
return self.to_json(indent=4)
stream: BufferedReader


@dataclass_json
@dataclass
class UrlSource:
class UrlSource(TypedDict):
"""
Represents a data source for specifying the location of a file via a URL.

Expand All @@ -117,22 +104,10 @@ class UrlSource:
url (str): The URL pointing to the hosted file.
"""

url: str = ""

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val
url: str

def __str__(self) -> str:
return self.to_json(indent=4)


@dataclass_json
@dataclass
class BufferSource:
class BufferSource(TypedDict):
"""
Represents a data source for handling raw binary data.

Expand All @@ -143,18 +118,8 @@ class BufferSource:
buffer (bytes): The binary data.
"""

buffer: bytes = b""

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val

def __str__(self) -> str:
return self.to_json(indent=4)
buffer: bytes


AnalyzeSource = Union[UrlSource, BufferSource, StreamSource]
TextSource = Union[BufferSource, StreamSource]
AnalyzeSource = Union[UrlSource, BufferSource, AnalyzeStreamSource]
TextSource = Union[BufferSource, AnalyzeStreamSource]
2 changes: 1 addition & 1 deletion deepgram/clients/prerecorded/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .client import (
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
FileSource,
PrerecordedSource,
)
Expand Down
6 changes: 3 additions & 3 deletions deepgram/clients/prerecorded/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PrerecordedOptions as PrerecordedOptionsLatest,
UrlSource as UrlSourceLatest,
BufferSource as BufferSourceLatest,
StreamSource as StreamSourceLatest,
ReadStreamSource as ReadStreamSourceLatest,
FileSource as FileSourceLatest,
PrerecordedSource as PrerecordedSourceLatest,
)
Expand Down Expand Up @@ -50,9 +50,9 @@ class BufferSource(BufferSourceLatest):
pass


class StreamSource(StreamSourceLatest):
class ReadStreamSource(ReadStreamSourceLatest):
"""
Please see StreamSourceLatest for details
Please see ReadStreamSourceLatest for details
"""

pass
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/prerecorded/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PrerecordedOptions,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
FileSource,
PrerecordedSource,
)
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/prerecorded/v1/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
PrerecordedOptions,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
FileSource,
PrerecordedSource,
)
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/prerecorded/v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
PrerecordedOptions,
UrlSource,
BufferSource,
StreamSource,
ReadStreamSource,
FileSource,
PrerecordedSource,
)
Expand Down
47 changes: 6 additions & 41 deletions deepgram/clients/prerecorded/v1/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from io import BufferedReader
from typing import Union, List, Optional
from typing_extensions import TypedDict
import logging, verboselogs


Expand Down Expand Up @@ -159,9 +160,7 @@ def check(self):
return True


@dataclass_json
@dataclass
class StreamSource:
class ReadStreamSource(TypedDict):
"""
Represents a data source for reading binary data from a stream-like source.

Expand All @@ -174,20 +173,8 @@ class StreamSource:

stream: BufferedReader

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val

def __str__(self) -> str:
return self.to_json(indent=4)


@dataclass_json
@dataclass
class UrlSource:
class UrlSource(TypedDict):
"""
Represents a data source for specifying the location of a file via a URL.

Expand All @@ -200,20 +187,8 @@ class UrlSource:

url: str

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val

def __str__(self) -> str:
return self.to_json(indent=4)


@dataclass_json
@dataclass
class BufferSource:
class BufferSource(TypedDict):
"""
Represents a data source for handling raw binary data.

Expand All @@ -226,16 +201,6 @@ class BufferSource:

buffer: bytes

def __getitem__(self, key):
_dict = self.to_dict()
return _dict[key]

def __setitem__(self, key, val):
self.__dict__[key] = val

def __str__(self) -> str:
return self.to_json(indent=4)


PrerecordedSource = Union[UrlSource, BufferSource, StreamSource]
FileSource = Union[BufferSource, StreamSource]
PrerecordedSource = Union[UrlSource, BufferSource, ReadStreamSource]
FileSource = Union[BufferSource, ReadStreamSource]
Loading