MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / decode_binary_ref

Function decode_binary_ref

dwave/cloud/coders.py:423–438  ·  view source on GitHub ↗

Decode binary-ref answer.

(msg: dict, ref_resolver: abc.Callable)

Source from the content-addressed store, hash-verified

421
422
423def decode_binary_ref(msg: dict, ref_resolver: abc.Callable) -> dict:
424 """Decode binary-ref answer."""
425
426 answer = msg['answer']
427 if answer['format'] != 'binary-ref':
428 raise ValueError(f"Unsupported answer format: {answer['format']}")
429 if 'auth_method' not in answer or 'url' not in answer:
430 raise ValueError("Incomplete binary-ref answer")
431
432 result = {
433 'problem_type': msg['type'],
434 'timing': answer.get('timing', {}),
435 'shape': answer.get('shape', {}),
436 'answer': ref_resolver(auth_method=answer['auth_method'], url=answer['url'])
437 }
438 return result
439
440
441def bqm_as_file(bqm, **options):

Callers 2

decode_responseMethod · 0.90
verify_problem_answerMethod · 0.90

Calls 1

getMethod · 0.45

Tested by 1

verify_problem_answerMethod · 0.72