|
7 | 7 | from smithy_core.aio.eventstream import DuplexEventStream |
8 | 8 | from smithy_core.exceptions import ExpectationNotMetError |
9 | 9 | from smithy_core.interceptors import InterceptorChain |
10 | | -from smithy_core.interfaces.retries import RetryStrategy |
11 | | -from smithy_core.retries import RetryStrategyOptions, RetryStrategyResolver |
| 10 | +from smithy_core.retries import RetryStrategyResolver |
12 | 11 | from smithy_core.types import TypedProperties |
13 | 12 | from smithy_http.plugins import user_agent_plugin |
14 | 13 |
|
@@ -105,22 +104,9 @@ async def get_medical_scribe_stream( |
105 | 104 | "protocol and transport MUST be set on the config to make calls." |
106 | 105 | ) |
107 | 106 |
|
108 | | - # Resolve retry strategy from config |
109 | | - if isinstance(config.retry_strategy, RetryStrategy): |
110 | | - retry_strategy = config.retry_strategy |
111 | | - elif isinstance(config.retry_strategy, RetryStrategyOptions): |
112 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
113 | | - options=config.retry_strategy |
114 | | - ) |
115 | | - elif config.retry_strategy is None: |
116 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
117 | | - options=RetryStrategyOptions() |
118 | | - ) |
119 | | - else: |
120 | | - raise TypeError( |
121 | | - f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, " |
122 | | - f"got {type(config.retry_strategy).__name__}" |
123 | | - ) |
| 107 | + retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
| 108 | + retry_strategy=config.retry_strategy |
| 109 | + ) |
124 | 110 |
|
125 | 111 | pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport) |
126 | 112 | call = ClientCall( |
@@ -179,22 +165,9 @@ async def start_call_analytics_stream_transcription( |
179 | 165 | "protocol and transport MUST be set on the config to make calls." |
180 | 166 | ) |
181 | 167 |
|
182 | | - # Resolve retry strategy from config |
183 | | - if isinstance(config.retry_strategy, RetryStrategy): |
184 | | - retry_strategy = config.retry_strategy |
185 | | - elif isinstance(config.retry_strategy, RetryStrategyOptions): |
186 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
187 | | - options=config.retry_strategy |
188 | | - ) |
189 | | - elif config.retry_strategy is None: |
190 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
191 | | - options=RetryStrategyOptions() |
192 | | - ) |
193 | | - else: |
194 | | - raise TypeError( |
195 | | - f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, " |
196 | | - f"got {type(config.retry_strategy).__name__}" |
197 | | - ) |
| 168 | + retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
| 169 | + retry_strategy=config.retry_strategy |
| 170 | + ) |
198 | 171 |
|
199 | 172 | pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport) |
200 | 173 | call = ClientCall( |
@@ -277,22 +250,9 @@ async def start_medical_scribe_stream( |
277 | 250 | "protocol and transport MUST be set on the config to make calls." |
278 | 251 | ) |
279 | 252 |
|
280 | | - # Resolve retry strategy from config |
281 | | - if isinstance(config.retry_strategy, RetryStrategy): |
282 | | - retry_strategy = config.retry_strategy |
283 | | - elif isinstance(config.retry_strategy, RetryStrategyOptions): |
284 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
285 | | - options=config.retry_strategy |
286 | | - ) |
287 | | - elif config.retry_strategy is None: |
288 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
289 | | - options=RetryStrategyOptions() |
290 | | - ) |
291 | | - else: |
292 | | - raise TypeError( |
293 | | - f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, " |
294 | | - f"got {type(config.retry_strategy).__name__}" |
295 | | - ) |
| 253 | + retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
| 254 | + retry_strategy=config.retry_strategy |
| 255 | + ) |
296 | 256 |
|
297 | 257 | pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport) |
298 | 258 | call = ClientCall( |
@@ -356,22 +316,9 @@ async def start_medical_stream_transcription( |
356 | 316 | "protocol and transport MUST be set on the config to make calls." |
357 | 317 | ) |
358 | 318 |
|
359 | | - # Resolve retry strategy from config |
360 | | - if isinstance(config.retry_strategy, RetryStrategy): |
361 | | - retry_strategy = config.retry_strategy |
362 | | - elif isinstance(config.retry_strategy, RetryStrategyOptions): |
363 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
364 | | - options=config.retry_strategy |
365 | | - ) |
366 | | - elif config.retry_strategy is None: |
367 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
368 | | - options=RetryStrategyOptions() |
369 | | - ) |
370 | | - else: |
371 | | - raise TypeError( |
372 | | - f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, " |
373 | | - f"got {type(config.retry_strategy).__name__}" |
374 | | - ) |
| 319 | + retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
| 320 | + retry_strategy=config.retry_strategy |
| 321 | + ) |
375 | 322 |
|
376 | 323 | pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport) |
377 | 324 | call = ClientCall( |
@@ -430,22 +377,9 @@ async def start_stream_transcription( |
430 | 377 | "protocol and transport MUST be set on the config to make calls." |
431 | 378 | ) |
432 | 379 |
|
433 | | - # Resolve retry strategy from config |
434 | | - if isinstance(config.retry_strategy, RetryStrategy): |
435 | | - retry_strategy = config.retry_strategy |
436 | | - elif isinstance(config.retry_strategy, RetryStrategyOptions): |
437 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
438 | | - options=config.retry_strategy |
439 | | - ) |
440 | | - elif config.retry_strategy is None: |
441 | | - retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
442 | | - options=RetryStrategyOptions() |
443 | | - ) |
444 | | - else: |
445 | | - raise TypeError( |
446 | | - f"retry_strategy must be RetryStrategy, RetryStrategyOptions, or None, " |
447 | | - f"got {type(config.retry_strategy).__name__}" |
448 | | - ) |
| 380 | + retry_strategy = await self._retry_strategy_resolver.resolve_retry_strategy( |
| 381 | + retry_strategy=config.retry_strategy |
| 382 | + ) |
449 | 383 |
|
450 | 384 | pipeline = RequestPipeline(protocol=config.protocol, transport=config.transport) |
451 | 385 | call = ClientCall( |
|
0 commit comments