Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _callback_till_result(kernel, response: Callback, response_type: Type[KernelResponse]) -> Any:
while isinstance(response, Callback):
try:
result = _handle_callback(kernel, response)
except Exception as exc:
response = kernel.sync_complete(response.cbid, str(exc), None, response_type)
else:
response = kernel.sync_complete(response.cbid, None, result, response_type)
if isinstance(response, InvokeResponse):
return response.result
elif isinstance(response, GetResponse):
return response.value
else:
return response
def get(self, obj: Referenceable, property: str) -> Any:
response = self.provider.get(
GetRequest(objref=obj.__jsii_ref__, property=property)
)
if isinstance(response, Callback):
return _callback_till_result(self, response, GetResponse)
else:
return response.value
def get(self, request: GetRequest) -> GetResponse:
return self._process.send(request, GetResponse)
def sget(self, request: StaticGetRequest) -> GetResponse:
return self._process.send(request, GetResponse)