MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / parse_response

Method parse_response

sdk/python/src/dstack_sdk/dstack_client.py:260–275  ·  view source on GitHub ↗

Parse response from service, automatically deserializing tcb_info. Args: obj: Raw response object from service tcb_info_type: The specific TcbInfo subclass to use for parsing

(cls, obj: Any, tcb_info_type: type[T])

Source from the content-addressed store, hash-verified

258
259 @classmethod
260 def parse_response(cls, obj: Any, tcb_info_type: type[T]) -> "InfoResponse[T]":
261 """Parse response from service, automatically deserializing tcb_info.
262
263 Args:
264 obj: Raw response object from service
265 tcb_info_type: The specific TcbInfo subclass to use for parsing
266
267 """
268 if (
269 isinstance(obj, dict)
270 and "tcb_info" in obj
271 and isinstance(obj["tcb_info"], str)
272 ):
273 obj = dict(obj)
274 obj["tcb_info"] = tcb_info_type(**json.loads(obj["tcb_info"]))
275 return cls(**obj)
276
277
278class BaseClient:

Callers 2

infoMethod · 0.80
infoMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected