From a131919ce9550164dc793cc5cec7e198bf1d5eaa Mon Sep 17 00:00:00 2001 From: David vonThenen <12752197+dvonthenen@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:39:52 -0700 Subject: [PATCH] Fix Import of Verboselogs Package --- deepgram/__init__.py | 17 ++++++++++++++++- deepgram/audio/microphone/constants.py | 2 +- deepgram/audio/microphone/microphone.py | 2 +- deepgram/client.py | 2 +- deepgram/clients/analyze/v1/async_client.py | 2 +- deepgram/clients/analyze/v1/client.py | 2 +- deepgram/clients/analyze/v1/options.py | 4 ++-- deepgram/clients/listen.py | 2 +- deepgram/clients/live/v1/async_client.py | 2 +- deepgram/clients/live/v1/client.py | 2 +- deepgram/clients/manage/v1/async_client.py | 2 +- deepgram/clients/manage/v1/client.py | 2 +- .../clients/prerecorded/v1/async_client.py | 2 +- deepgram/clients/prerecorded/v1/client.py | 2 +- deepgram/clients/read.py | 2 +- .../clients/selfhosted/v1/async_client.py | 2 +- deepgram/clients/selfhosted/v1/client.py | 2 +- deepgram/clients/speak/v1/async_client.py | 2 +- deepgram/clients/speak/v1/client.py | 2 +- deepgram/clients/speak/v1/options.py | 2 +- deepgram/options.py | 2 +- deepgram/utils/__init__.py | 19 +++++++++++++++++++ 22 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 deepgram/utils/__init__.py diff --git a/deepgram/__init__.py b/deepgram/__init__.py index aca6f16a..06e2766d 100644 --- a/deepgram/__init__.py +++ b/deepgram/__init__.py @@ -6,7 +6,22 @@ __version__ = "0.0.0" # entry point for the deepgram python sdk -from .client import verboselogs +import logging +from .utils import VerboseLogger +from .utils import ( + NOTICE, + SPAM, + SUCCESS, + VERBOSE, + WARNING, + ERROR, + FATAL, + CRITICAL, + INFO, + DEBUG, + NOTSET, +) + from .client import Deepgram, DeepgramClient from .client import DeepgramClientOptions, ClientOptionsFromEnv from .client import DeepgramApiKeyError, DeepgramModuleError diff --git a/deepgram/audio/microphone/constants.py b/deepgram/audio/microphone/constants.py index f7bcc545..6570fd4d 100644 --- a/deepgram/audio/microphone/constants.py +++ b/deepgram/audio/microphone/constants.py @@ -2,7 +2,7 @@ # Use of this source code is governed by a MIT license that can be found in the LICENSE file. # SPDX-License-Identifier: MIT -from deepgram.utils import verboselogs +from ...utils import verboselogs # Constants for microphone diff --git a/deepgram/audio/microphone/microphone.py b/deepgram/audio/microphone/microphone.py index 572fb20e..19bcf9e0 100644 --- a/deepgram/audio/microphone/microphone.py +++ b/deepgram/audio/microphone/microphone.py @@ -8,7 +8,7 @@ from typing import Optional, Callable import logging -from deepgram.utils import verboselogs +from ...utils import verboselogs from .constants import LOGGING, CHANNELS, RATE, CHUNK diff --git a/deepgram/client.py b/deepgram/client.py index ce51f167..378ab4ab 100644 --- a/deepgram/client.py +++ b/deepgram/client.py @@ -7,7 +7,7 @@ import os import logging -from deepgram.utils import verboselogs +from .utils import verboselogs # common # pylint: disable=unused-import diff --git a/deepgram/clients/analyze/v1/async_client.py b/deepgram/clients/analyze/v1/async_client.py index e9676b43..69d6bc94 100644 --- a/deepgram/clients/analyze/v1/async_client.py +++ b/deepgram/clients/analyze/v1/async_client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_async_client import AbstractAsyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/analyze/v1/client.py b/deepgram/clients/analyze/v1/client.py index 373a09ed..602694b1 100644 --- a/deepgram/clients/analyze/v1/client.py +++ b/deepgram/clients/analyze/v1/client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_sync_client import AbstractSyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/analyze/v1/options.py b/deepgram/clients/analyze/v1/options.py index 7b23e0e9..631ed414 100644 --- a/deepgram/clients/analyze/v1/options.py +++ b/deepgram/clients/analyze/v1/options.py @@ -2,13 +2,13 @@ # Use of this source code is governed by a MIT license that can be found in the LICENSE file. # SPDX-License-Identifier: MIT -from typing import List, Union, Optional import logging +from typing import List, Union, Optional from dataclasses import dataclass, field from dataclasses_json import config as dataclass_config, DataClassJsonMixin -from deepgram.utils import verboselogs +from ....utils import verboselogs from ...common import FileSource, StreamSource, UrlSource diff --git a/deepgram/clients/listen.py b/deepgram/clients/listen.py index 9e2278c2..f69254f2 100644 --- a/deepgram/clients/listen.py +++ b/deepgram/clients/listen.py @@ -5,7 +5,7 @@ from importlib import import_module import logging -from deepgram.utils import verboselogs +from ..utils import verboselogs from ..options import DeepgramClientOptions from .errors import DeepgramModuleError diff --git a/deepgram/clients/live/v1/async_client.py b/deepgram/clients/live/v1/async_client.py index 5d5cfda5..2f09d12b 100644 --- a/deepgram/clients/live/v1/async_client.py +++ b/deepgram/clients/live/v1/async_client.py @@ -11,7 +11,7 @@ import websockets from websockets.client import WebSocketClientProtocol -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ..enums import LiveTranscriptionEvents from ..helpers import convert_to_websocket_url, append_query_params diff --git a/deepgram/clients/live/v1/client.py b/deepgram/clients/live/v1/client.py index 379b44d6..aaad979a 100644 --- a/deepgram/clients/live/v1/client.py +++ b/deepgram/clients/live/v1/client.py @@ -11,7 +11,7 @@ from websockets.sync.client import connect, ClientConnection import websockets -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ..enums import LiveTranscriptionEvents from ..helpers import convert_to_websocket_url, append_query_params diff --git a/deepgram/clients/manage/v1/async_client.py b/deepgram/clients/manage/v1/async_client.py index 8e7b31b0..9adcc36d 100644 --- a/deepgram/clients/manage/v1/async_client.py +++ b/deepgram/clients/manage/v1/async_client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_async_client import AbstractAsyncRestClient diff --git a/deepgram/clients/manage/v1/client.py b/deepgram/clients/manage/v1/client.py index b3ae4bc1..91de15be 100644 --- a/deepgram/clients/manage/v1/client.py +++ b/deepgram/clients/manage/v1/client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_sync_client import AbstractSyncRestClient diff --git a/deepgram/clients/prerecorded/v1/async_client.py b/deepgram/clients/prerecorded/v1/async_client.py index ad422066..435ddded 100644 --- a/deepgram/clients/prerecorded/v1/async_client.py +++ b/deepgram/clients/prerecorded/v1/async_client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_async_client import AbstractAsyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/prerecorded/v1/client.py b/deepgram/clients/prerecorded/v1/client.py index 3c0d7959..fa38d19b 100644 --- a/deepgram/clients/prerecorded/v1/client.py +++ b/deepgram/clients/prerecorded/v1/client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_sync_client import AbstractSyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/read.py b/deepgram/clients/read.py index 28e01091..9ce4c81c 100644 --- a/deepgram/clients/read.py +++ b/deepgram/clients/read.py @@ -5,7 +5,7 @@ from importlib import import_module import logging -from deepgram.utils import verboselogs +from ..utils import verboselogs from ..options import DeepgramClientOptions from .errors import DeepgramModuleError diff --git a/deepgram/clients/selfhosted/v1/async_client.py b/deepgram/clients/selfhosted/v1/async_client.py index 6b15feaf..fc1cbc8d 100644 --- a/deepgram/clients/selfhosted/v1/async_client.py +++ b/deepgram/clients/selfhosted/v1/async_client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_async_client import AbstractAsyncRestClient diff --git a/deepgram/clients/selfhosted/v1/client.py b/deepgram/clients/selfhosted/v1/client.py index 586d8d36..419e704c 100644 --- a/deepgram/clients/selfhosted/v1/client.py +++ b/deepgram/clients/selfhosted/v1/client.py @@ -7,7 +7,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_sync_client import AbstractSyncRestClient diff --git a/deepgram/clients/speak/v1/async_client.py b/deepgram/clients/speak/v1/async_client.py index 6ebbb292..6f60be3d 100644 --- a/deepgram/clients/speak/v1/async_client.py +++ b/deepgram/clients/speak/v1/async_client.py @@ -9,7 +9,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_async_client import AbstractAsyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/speak/v1/client.py b/deepgram/clients/speak/v1/client.py index 4ad5113d..5eb40bd0 100644 --- a/deepgram/clients/speak/v1/client.py +++ b/deepgram/clients/speak/v1/client.py @@ -8,7 +8,7 @@ import httpx -from deepgram.utils import verboselogs +from ....utils import verboselogs from ....options import DeepgramClientOptions from ...abstract_sync_client import AbstractSyncRestClient from ..errors import DeepgramError, DeepgramTypeError diff --git a/deepgram/clients/speak/v1/options.py b/deepgram/clients/speak/v1/options.py index f46e0252..1fa11d86 100644 --- a/deepgram/clients/speak/v1/options.py +++ b/deepgram/clients/speak/v1/options.py @@ -9,7 +9,7 @@ from dataclasses import dataclass, field from dataclasses_json import config as dataclass_config, DataClassJsonMixin -from deepgram.utils import verboselogs +from ....utils import verboselogs from ...common import FileSource diff --git a/deepgram/options.py b/deepgram/options.py index ba015642..35ae8489 100644 --- a/deepgram/options.py +++ b/deepgram/options.py @@ -10,7 +10,7 @@ import numbers from deepgram import __version__ -from deepgram.utils import verboselogs +from .utils import verboselogs from .errors import DeepgramApiKeyError diff --git a/deepgram/utils/__init__.py b/deepgram/utils/__init__.py new file mode 100644 index 00000000..21343d9d --- /dev/null +++ b/deepgram/utils/__init__.py @@ -0,0 +1,19 @@ +# Copyright 2024 Deepgram SDK contributors. All Rights Reserved. +# Use of this source code is governed by a MIT license that can be found in the LICENSE file. +# SPDX-License-Identifier: MIT + +import logging +from .verboselogs import VerboseLogger +from .verboselogs import ( + NOTICE, + SPAM, + SUCCESS, + VERBOSE, + WARNING, + ERROR, + FATAL, + CRITICAL, + INFO, + DEBUG, + NOTSET, +)