6
6
# --------------------------------------------------------------------------
7
7
8
8
9
- from typing import TYPE_CHECKING , Any , Callable , Union
9
+ from typing import Any , Callable , Union
10
10
11
11
from azure .core .credentials import AccessToken , AzureKeyCredential
12
12
from azure .core .paging import ItemPaged
13
13
from azure .core .pipeline .policies import BearerTokenCredentialPolicy
14
14
from azure .core .polling import LROPoller
15
15
from azure .core .tracing .decorator import distributed_trace
16
+ from azure .core .credentials import TokenCredential
16
17
17
18
from ._api_version import validate_api_version , DEFAULT_VERSION
18
19
from ._generated import RemoteRenderingRestClient
32
33
from ._shared .static_access_token_credential import StaticAccessTokenCredential
33
34
from ._version import SDK_MONIKER
34
35
35
- if TYPE_CHECKING :
36
- from azure .core .credentials import TokenCredential
37
-
38
- # pylint: disable=unsubscriptable-object
39
-
40
-
41
36
class RemoteRenderingClient :
42
37
"""A client for the Azure Remote Rendering Service.
43
38
@@ -126,8 +121,11 @@ def __init__(self,
126
121
** kwargs )
127
122
128
123
@distributed_trace
129
- def begin_asset_conversion (self , conversion_id , input_settings , output_settings , ** kwargs ):
130
- # type: (str, AssetConversionInputSettings, AssetConversionOutputSettings, Any) -> LROPoller[AssetConversion]
124
+ def begin_asset_conversion (self ,
125
+ conversion_id : str ,
126
+ input_settings : AssetConversionInputSettings ,
127
+ output_settings : AssetConversionOutputSettings ,
128
+ ** kwargs ) -> LROPoller [AssetConversion ]:
131
129
"""
132
130
Start a new asset conversion with the given options.
133
131
:param str conversion_id:
@@ -161,8 +159,7 @@ def begin_asset_conversion(self, conversion_id, input_settings, output_settings,
161
159
polling_method = polling_method )
162
160
163
161
@distributed_trace
164
- def get_asset_conversion (self , conversion_id , ** kwargs ):
165
- # type: (str, Any) -> AssetConversion
162
+ def get_asset_conversion (self , conversion_id : str , ** kwargs ) -> AssetConversion :
166
163
"""
167
164
Retrieve the state of a previously created conversion.
168
165
:param str conversion_id:
@@ -175,23 +172,19 @@ def get_asset_conversion(self, conversion_id, **kwargs):
175
172
account_id = self ._account_id , conversion_id = conversion_id , ** kwargs )
176
173
177
174
@distributed_trace
178
- def get_asset_conversion_poller (self , ** kwargs ):
179
- # type: (Any) -> LROPoller[AssetConversion]
175
+ def get_asset_conversion_poller (self , ** kwargs ) -> LROPoller [AssetConversion ]: # pylint:disable=docstring-keyword-should-match-keyword-only
180
176
"""
181
177
Returns a poller for an existing conversion by conversion id or a continuation token retrieved from a previous
182
178
poller.
183
- :keyword conversion_id: The conversion id of a previously created conversion.
184
- :paramtype conversion_id: str
185
- :keyword continuation_token:
186
- A continuation token retrieved from a poller of a conversion.
187
- :paramtype continuation_token: str
179
+ :keyword str conversion_id: The conversion_id of a previously created conversion.
180
+ :keyword str continuation_token: A continuation token retrieved from a poller of a conversion.
188
181
:return: A poller for the created asset conversion
189
182
:rtype: ~azure.core.polling.LROPoller[AssetConversion]
190
183
:raises ~azure.core.exceptions.HttpResponseError:
191
184
"""
192
185
193
- conversion_id = kwargs .pop ("conversion_id" , None ) # type: Union[str,None]
194
- continuation_token = kwargs .pop ("continuation_token" , None ) # type: Union[str,None]
186
+ conversion_id : Union [ str , None ] = kwargs .pop ("conversion_id" , None )
187
+ continuation_token : Union [ str , None ] = kwargs .pop ("continuation_token" , None )
195
188
196
189
if conversion_id is None and continuation_token is None :
197
190
raise ValueError (
@@ -222,18 +215,20 @@ def get_asset_conversion_poller(self, **kwargs):
222
215
polling_method = polling_method )
223
216
224
217
@distributed_trace
225
- def list_asset_conversions (self , ** kwargs ):
226
- # type: (...) -> ItemPaged[AssetConversion]
218
+ def list_asset_conversions (self , ** kwargs ) -> ItemPaged [AssetConversion ]:
227
219
""" Returns list of conversions for the remote rendering account.
228
220
:rtype: ItemPaged[AssetConversion]
229
221
:raises ~azure.core.exceptions.HttpResponseError:
230
222
:return: List of conversion for the remote rendering account.
231
223
"""
232
- return self ._client .remote_rendering .list_conversions (account_id = self ._account_id , ** kwargs ) # type: ignore
224
+ return self ._client .remote_rendering .list_conversions (account_id = self ._account_id , ** kwargs ) # type: ignore
233
225
234
226
@distributed_trace
235
- def begin_rendering_session (self , session_id , size , lease_time_minutes , ** kwargs ):
236
- # type: (str, Union[str, RenderingSessionSize], int, Any) -> LROPoller[RenderingSession]
227
+ def begin_rendering_session (self ,
228
+ session_id : str ,
229
+ size : Union [str , RenderingSessionSize ],
230
+ lease_time_minutes : int ,
231
+ ** kwargs ) -> LROPoller [RenderingSession ]:
237
232
"""
238
233
:param str session_id: An ID uniquely identifying the rendering session for the given account. The ID is case
239
234
sensitive, can contain any combination of alphanumeric characters including hyphens and underscores, and
@@ -263,8 +258,7 @@ def begin_rendering_session(self, session_id, size, lease_time_minutes, **kwargs
263
258
polling_method = polling_method )
264
259
265
260
@distributed_trace
266
- def get_rendering_session (self , session_id , ** kwargs ):
267
- # type: (str, Any) -> RenderingSession
261
+ def get_rendering_session (self , session_id : str , ** kwargs ) -> RenderingSession :
268
262
'''
269
263
Returns the properties of a previously generated rendering session.
270
264
:param str session_id: The identifier of the rendering session.
@@ -278,23 +272,19 @@ def get_rendering_session(self, session_id, **kwargs):
278
272
** kwargs )
279
273
280
274
@distributed_trace
281
- def get_rendering_session_poller (self , ** kwargs ):
282
- # type: (Any) -> LROPoller[RenderingSession]
275
+ def get_rendering_session_poller (self , ** kwargs ) -> LROPoller [RenderingSession ]: # pylint:disable=docstring-keyword-should-match-keyword-only
283
276
"""
284
277
Returns a poller for an existing rendering session by session id or a continuation token retrieved from a
285
278
previous poller.
286
- :keyword session_id: The conversion id of a previously created conversion.
287
- :paramtype session_id: str
288
- :keyword continuation_token:
289
- A continuation token retrieved from a poller of a session.
290
- :paramtype continuation_token: str
279
+ :keyword str session_id: The conversion id of a previously created conversion.
280
+ :keyword str continuation_token: A continuation token retrieved from a poller of a session.
291
281
:return: A session poller for the given session
292
282
:rtype: LROPoller[RenderingSession]
293
283
:raises ~azure.core.exceptions.HttpResponseError:
294
284
"""
295
285
296
- session_id = kwargs .pop ("session_id" , None ) # type: Union[str,None]
297
- continuation_token = kwargs .pop ("continuation_token" , None ) # type: Union[str,None]
286
+ session_id : Union [ str , None ] = kwargs .pop ("session_id" , None )
287
+ continuation_token : Union [ str , None ] = kwargs .pop ("continuation_token" , None )
298
288
299
289
if session_id is None and continuation_token is None :
300
290
raise ValueError (
@@ -325,8 +315,7 @@ def get_rendering_session_poller(self, **kwargs):
325
315
polling_method = polling_method )
326
316
327
317
@distributed_trace
328
- def stop_rendering_session (self , session_id , ** kwargs ):
329
- # type: (str, Any) -> None
318
+ def stop_rendering_session (self , session_id : str , ** kwargs ) -> None :
330
319
"""
331
320
:param str session_id: The identifier of the session to be stopped.
332
321
:return: None
@@ -337,20 +326,18 @@ def stop_rendering_session(self, session_id, **kwargs):
337
326
account_id = self ._account_id , session_id = session_id , ** kwargs )
338
327
339
328
@distributed_trace
340
- def update_rendering_session (self , session_id , ** kwargs ):
341
- # type: (str, Any) -> RenderingSession
329
+ def update_rendering_session (self , session_id : str , ** kwargs ) -> RenderingSession : # pylint:disable=docstring-keyword-should-match-keyword-only
342
330
"""
343
331
Updates an already existing rendering session.
344
332
:param str session_id: The identifier of the session to be updated.
345
- :keyword lease_time_minutes: The new lease time of the rendering session. Has to be strictly larger than
333
+ :keyword int lease_time_minutes: The new lease time of the rendering session. Has to be strictly larger than
346
334
the previous lease time.
347
- :paramtype lease_time_minutes: int
348
335
:return: The properties of the updated session
349
336
:rtype: ~azure.mixedreality.remoterendering.models.RenderingSession
350
337
:raises ~azure.core.exceptions.HttpResponseError:
351
338
"""
352
339
353
- lease_time_minutes = kwargs .pop ("lease_time_minutes" , None ) # type: Union[int,None]
340
+ lease_time_minutes : Union [ int , None ] = kwargs .pop ("lease_time_minutes" , None )
354
341
if lease_time_minutes is not None :
355
342
return self ._client .remote_rendering .update_session (account_id = self ._account_id ,
356
343
session_id = session_id ,
@@ -364,8 +351,7 @@ def update_rendering_session(self, session_id, **kwargs):
364
351
** kwargs )
365
352
366
353
@distributed_trace
367
- def list_rendering_sessions (self , ** kwargs ):
368
- # type: (...) -> ItemPaged[RenderingSession]
354
+ def list_rendering_sessions (self , ** kwargs ) -> ItemPaged [RenderingSession ]:
369
355
"""
370
356
Returns list of rendering sessions in the 'Ready' or 'Starting' state.
371
357
Does not return stopped or failed rendering sessions.
@@ -375,15 +361,12 @@ def list_rendering_sessions(self, **kwargs):
375
361
"""
376
362
return self ._client .remote_rendering .list_sessions (account_id = self ._account_id , ** kwargs ) # type: ignore
377
363
378
- def close (self ):
379
- # type: () -> None
364
+ def close (self ) -> None :
380
365
self ._client .close ()
381
366
382
- def __enter__ (self ):
383
- # type: () -> RemoteRenderingClient
367
+ def __enter__ (self ) -> "RemoteRenderingClient" :
384
368
self ._client .__enter__ () # pylint:disable=no-member
385
369
return self
386
370
387
- def __exit__ (self , * args ):
388
- # type: (*Any) -> None
371
+ def __exit__ (self , * args : Any ) -> None :
389
372
self ._client .__exit__ (* args ) # pylint:disable=no-member
0 commit comments