|
5 | 5 | import httpx |
6 | 6 | import logging, verboselogs |
7 | 7 | import json |
8 | | -from typing import Dict, Union |
| 8 | +from typing import Dict, Union, Optional |
9 | 9 |
|
10 | 10 | from ...abstract_sync_client import AbstractSyncRestClient |
11 | 11 | from ..errors import DeepgramError, DeepgramTypeError |
@@ -54,11 +54,11 @@ def __init__(self, config): |
54 | 54 | def analyze_url( |
55 | 55 | self, |
56 | 56 | source: UrlSource, |
57 | | - options: Union[AnalyzeOptions, Dict] = None, |
58 | | - addons: Dict = None, |
59 | | - timeout: httpx.Timeout = None, |
| 57 | + options: Optional[Union[AnalyzeOptions, Dict]] = None, |
| 58 | + addons: Optional[Dict] = None, |
| 59 | + timeout: Optional[httpx.Timeout] = None, |
60 | 60 | endpoint: str = "v1/read", |
61 | | - ) -> AnalyzeResponse: |
| 61 | + ) -> Union[AnalyzeResponse, AsyncAnalyzeResponse]: |
62 | 62 | self.logger.debug("AnalyzeClient.analyze_url ENTER") |
63 | 63 |
|
64 | 64 | if (options is Dict and "callback" in options is not None) or ( |
@@ -119,9 +119,9 @@ def analyze_url_callback( |
119 | 119 | self, |
120 | 120 | source: UrlSource, |
121 | 121 | callback: str, |
122 | | - options: Union[AnalyzeOptions, Dict] = None, |
123 | | - addons: Dict = None, |
124 | | - timeout: httpx.Timeout = None, |
| 122 | + options: Optional[Union[AnalyzeOptions, Dict]] = None, |
| 123 | + addons: Optional[Dict] = None, |
| 124 | + timeout: Optional[httpx.Timeout] = None, |
125 | 125 | endpoint: str = "v1/read", |
126 | 126 | ) -> AsyncAnalyzeResponse: |
127 | 127 | self.logger.debug("AnalyzeClient.analyze_url_callback ENTER") |
@@ -180,11 +180,11 @@ def analyze_url_callback( |
180 | 180 | def analyze_text( |
181 | 181 | self, |
182 | 182 | source: TextSource, |
183 | | - options: Union[AnalyzeOptions, Dict] = None, |
184 | | - addons: Dict = None, |
185 | | - timeout: httpx.Timeout = None, |
| 183 | + options: Optional[Union[AnalyzeOptions, Dict]] = None, |
| 184 | + addons: Optional[Dict] = None, |
| 185 | + timeout: Optional[httpx.Timeout] = None, |
186 | 186 | endpoint: str = "v1/read", |
187 | | - ) -> AnalyzeResponse: |
| 187 | + ) -> Union[AnalyzeResponse, AsyncAnalyzeResponse]: |
188 | 188 | self.logger.debug("AnalyzeClient.analyze_text ENTER") |
189 | 189 |
|
190 | 190 | if (options is Dict and "callback" in options is not None) or ( |
@@ -246,9 +246,9 @@ def analyze_file_callback( |
246 | 246 | self, |
247 | 247 | source: TextSource, |
248 | 248 | callback: str, |
249 | | - options: Union[AnalyzeOptions, Dict] = None, |
250 | | - addons: Dict = None, |
251 | | - timeout: httpx.Timeout = None, |
| 249 | + options: Optional[Union[AnalyzeOptions, Dict]] = None, |
| 250 | + addons: Optional[Dict] = None, |
| 251 | + timeout: Optional[httpx.Timeout] = None, |
252 | 252 | endpoint: str = "v1/read", |
253 | 253 | ) -> AsyncAnalyzeResponse: |
254 | 254 | self.logger.debug("AnalyzeClient.analyze_file_callback ENTER") |
|
0 commit comments