Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvonthenen committed Jul 1, 2024
1 parent 7f73918 commit ca02b93
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 57 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ ensure-deps: #### Ensure that all required dependency utilities are downloaded o

GO_MODULES=$(shell find . -path "*/go.mod" | xargs -I _ dirname _)

# pystatic: #### Performs Python static analysis
# pylint --rcfile .pylintrc deepgram

PYTHON_FILES=.
lint_files: PYTHON_FILES=deepgram/ examples/
lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')
Expand All @@ -56,7 +53,7 @@ lint_files lint_diff: #### Performs Python formatting
black blackformat format: lint_files

pylint: lint_files #### Performs Python linting
pylint --rcfile .pylintrc deepgram
pylint --disable=W0622 --disable=W0404 --disable=W0611 --rcfile .pylintrc deepgram

lint: pylint #### Performs Golang programming lint

Expand Down
29 changes: 18 additions & 11 deletions deepgram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,27 @@
UrlSource,
Sentiment,
)
from .client import (
OpenResponse,
MetadataResponse,
CloseResponse,
UnhandledResponse,
ErrorResponse,
)

# live
from .client import LiveTranscriptionEvents
from .client import LiveClient, AsyncLiveClient
from .client import LiveOptions
from .client import (
OpenResponse,
# OpenResponse,
LiveResultResponse,
MetadataResponse,
# MetadataResponse,
SpeechStartedResponse,
UtteranceEndResponse,
CloseResponse,
UnhandledResponse,
ErrorResponse,
# CloseResponse,
# UnhandledResponse,
# ErrorResponse,
)

# prerecorded
Expand Down Expand Up @@ -84,7 +91,7 @@
# speak
from .client import (
SpeakOptions,
FileSource,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
)
Expand All @@ -109,13 +116,13 @@
)
from .client import (
SpeakWebSocketResponse,
OpenResponse,
MetadataResponse,
# OpenResponse,
# MetadataResponse,
FlushedResponse,
CloseResponse,
UnhandledResponse,
# CloseResponse,
# UnhandledResponse,
WarningResponse,
ErrorResponse,
# ErrorResponse,
)

# manage
Expand Down
34 changes: 20 additions & 14 deletions deepgram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from typing import Optional
from importlib import import_module
import os

import deprecation
import logging
import deprecation # type: ignore

from . import __version__
import logging
from .utils import verboselogs

# common
Expand All @@ -22,6 +21,13 @@
UrlSource,
Sentiment,
)
from .clients import (
OpenResponse,
MetadataResponse,
CloseResponse,
UnhandledResponse,
ErrorResponse,
)

# listen client
from .clients import Listen, Read, Speak
Expand All @@ -35,14 +41,14 @@

# live client responses
from .clients import (
OpenResponse,
# OpenResponse,
LiveResultResponse,
MetadataResponse,
# MetadataResponse,
SpeechStartedResponse,
UtteranceEndResponse,
CloseResponse,
ErrorResponse,
UnhandledResponse,
# CloseResponse,
# ErrorResponse,
# UnhandledResponse,
)

# prerecorded
Expand Down Expand Up @@ -82,7 +88,7 @@
# speak
from .clients import (
SpeakOptions,
FileSource,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
)
Expand All @@ -107,13 +113,13 @@
)
from .clients import (
SpeakWebSocketResponse,
OpenResponse,
MetadataResponse,
# OpenResponse,
# MetadataResponse,
FlushedResponse,
CloseResponse,
UnhandledResponse,
# CloseResponse,
# UnhandledResponse,
WarningResponse,
ErrorResponse,
# ErrorResponse,
)

# manage client classes/input
Expand Down
33 changes: 20 additions & 13 deletions deepgram/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
UrlSource,
Sentiment,
)
from .listen import (
OpenResponse,
MetadataResponse,
CloseResponse,
UnhandledResponse,
ErrorResponse,
)

from .listen_router import Listen
from .read_router import Read
Expand All @@ -34,8 +41,8 @@
from .listen import (
PrerecordedOptions,
PreRecordedStreamSource,
UrlSource,
FileSource,
# UrlSource,
# FileSource,
PrerecordedSource,
)

Expand All @@ -55,14 +62,14 @@

## output
from .listen import (
OpenResponse,
# OpenResponse,
LiveResultResponse,
MetadataResponse,
# MetadataResponse,
SpeechStartedResponse,
UtteranceEndResponse,
CloseResponse,
ErrorResponse,
UnhandledResponse,
# CloseResponse,
# ErrorResponse,
# UnhandledResponse,
)

## clients
Expand Down Expand Up @@ -90,7 +97,7 @@
## common
from .speak import (
SpeakOptions,
FileSource,
# FileSource,
SpeakWebSocketSource,
SpeakSource,
)
Expand All @@ -116,13 +123,13 @@
)
from .speak import (
SpeakWebSocketResponse,
OpenResponse,
MetadataResponse,
# OpenResponse,
# MetadataResponse,
FlushedResponse,
CloseResponse,
UnhandledResponse,
# CloseResponse,
# UnhandledResponse,
WarningResponse,
ErrorResponse,
# ErrorResponse,
)

# manage
Expand Down
2 changes: 1 addition & 1 deletion deepgram/clients/listen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT


from ...options import DeepgramClientOptions, ClientOptionsFromEnv
# from ...options import DeepgramClientOptions, ClientOptionsFromEnv

# rest
from .v1 import (
Expand Down
3 changes: 1 addition & 2 deletions deepgram/clients/listen_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from importlib import import_module
import logging

import deprecation
import deprecation # type: ignore

from .. import __version__
from .listen.v1 import (
Expand Down
4 changes: 2 additions & 2 deletions deepgram/clients/speak/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
SpeakWebSocketResponse as SpeakWebSocketResponseLatest,
OpenResponse as OpenResponseLatest,
MetadataResponse as MetadataResponseLatest,
FlushedResponse as MetadataResponseLatest,
FlushedResponse as FlushedResponseLatest,
CloseResponse as CloseResponseLatest,
UnhandledResponse as UnhandledResponseLatest,
WarningResponse as WarningResponseLatest,
Expand All @@ -41,7 +41,7 @@
SpeakWebSocketResponse = SpeakWebSocketResponseLatest
OpenResponse = OpenResponseLatest
MetadataResponse = MetadataResponseLatest
FlushedResponse = MetadataResponseLatest
FlushedResponse = FlushedResponseLatest
CloseResponse = CloseResponseLatest
UnhandledResponse = UnhandledResponseLatest
WarningResponse = WarningResponseLatest
Expand Down
8 changes: 1 addition & 7 deletions deepgram/clients/speak/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
from .options import SpeakOptions, FileSource, SpeakWebSocketSource, SpeakSource
from ....options import DeepgramClientOptions, ClientOptionsFromEnv

# backward compatibility
from .rest import (
SpeakRESTClient as SpeakClient,
AsyncSpeakRESTClient as AsyncSpeakClient,
)
from .rest import SpeakRESTResponse as SpeakResponse

# rest
from .rest import SpeakRESTClient, AsyncSpeakRESTClient

from .rest import SpeakRESTResponse

# websocket
Expand Down
7 changes: 5 additions & 2 deletions deepgram/clients/speak_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from importlib import import_module
import logging

import deprecation
import deprecation # type: ignore

from .. import __version__
from .speak.v1.rest.client import SpeakRESTClient
Expand Down Expand Up @@ -38,6 +37,8 @@ def __init__(self, config: DeepgramClientOptions):
self._logger.setLevel(config.verbose)
self._config = config

# when this is removed, remove --disable=W0622 from Makefile
# pylint: disable=unused-argument
@deprecation.deprecated(
deprecated_in="3.4.0",
removed_in="4.0.0",
Expand All @@ -50,6 +51,8 @@ def v(self, version: str = ""):
"""
return SpeakRESTClient(self._config)

# pylint: enable=unused-argument

@property
def rest(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ ignore_missing_imports = True
ignore_missing_imports = True

[mypy-aenum]
ignore_missing_imports = True
ignore_missing_imports = True

0 comments on commit ca02b93

Please sign in to comment.