# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @generated # cimport cython from typing import AsyncIterator from cpython.version cimport PY_VERSION_HEX from libc.stdint cimport ( int8_t as cint8_t, int16_t as cint16_t, int32_t as cint32_t, int64_t as cint64_t, ) from libcpp.memory cimport shared_ptr, make_shared, unique_ptr from libcpp.string cimport string from libcpp cimport bool as cbool from cpython cimport bool as pbool from libcpp.vector cimport vector from libcpp.set cimport set as cset from libcpp.map cimport map as cmap from libcpp.utility cimport move as cmove from libcpp.pair cimport pair from cython.operator cimport dereference as deref from cpython.ref cimport PyObject from thrift.py3.exceptions cimport ( cTApplicationException, ApplicationError as __ApplicationError, cTApplicationExceptionType__UNKNOWN) from thrift.py3.server cimport ServiceInterface, RequestContext, Cpp2RequestContext from thrift.py3.server import RequestContext from folly cimport ( cFollyPromise, cFollyUnit, c_unit, ) from thrift.py3.common cimport ( cThriftServiceMetadataResponse as __fbthrift_cThriftServiceMetadataResponse, ServiceMetadata, MetadataBox as __MetadataBox, ) from thrift.py3.server cimport THRIFT_REQUEST_CONTEXT as __THRIFT_REQUEST_CONTEXT from thrift.py3.types cimport make_unique cimport folly.futures from folly.executor cimport get_executor cimport folly.iobuf as _fbthrift_iobuf import folly.iobuf as _fbthrift_iobuf from folly.iobuf cimport move as move_iobuf from folly.memory cimport to_shared_ptr as __to_shared_ptr cimport module.types as _module_types import module.types as _module_types cimport module.services_reflection as _services_reflection import asyncio import functools import sys import traceback import types as _py_types from module.services_wrapper cimport cMyServiceInterface from module.services_wrapper cimport cMyServicePrioParentInterface from module.services_wrapper cimport cMyServicePrioChildInterface from module.services_wrapper cimport cBadServiceInterface from module.services_wrapper cimport cFooBarBazServiceInterface @cython.auto_pickle(False) cdef class Promise_cbool: cdef cFollyPromise[cbool]* cPromise def __cinit__(self): self.cPromise = new cFollyPromise[cbool](cFollyPromise[cbool].makeEmpty()) def __dealloc__(self): del self.cPromise @staticmethod cdef _fbthrift_create(cFollyPromise[cbool] cPromise): cdef Promise_cbool inst = Promise_cbool.__new__(Promise_cbool) inst.cPromise[0] = cmove(cPromise) return inst @cython.auto_pickle(False) cdef class Promise_cint32_t: cdef cFollyPromise[cint32_t]* cPromise def __cinit__(self): self.cPromise = new cFollyPromise[cint32_t](cFollyPromise[cint32_t].makeEmpty()) def __dealloc__(self): del self.cPromise @staticmethod cdef _fbthrift_create(cFollyPromise[cint32_t] cPromise): cdef Promise_cint32_t inst = Promise_cint32_t.__new__(Promise_cint32_t) inst.cPromise[0] = cmove(cPromise) return inst @cython.auto_pickle(False) cdef class Promise_string: cdef cFollyPromise[unique_ptr[string]]* cPromise def __cinit__(self): self.cPromise = new cFollyPromise[unique_ptr[string]](cFollyPromise[unique_ptr[string]].makeEmpty()) def __dealloc__(self): del self.cPromise @staticmethod cdef _fbthrift_create(cFollyPromise[unique_ptr[string]] cPromise): cdef Promise_string inst = Promise_string.__new__(Promise_string) inst.cPromise[0] = cmove(cPromise) return inst @cython.auto_pickle(False) cdef class Promise_cFollyUnit: cdef cFollyPromise[cFollyUnit]* cPromise def __cinit__(self): self.cPromise = new cFollyPromise[cFollyUnit](cFollyPromise[cFollyUnit].makeEmpty()) def __dealloc__(self): del self.cPromise @staticmethod cdef _fbthrift_create(cFollyPromise[cFollyUnit] cPromise): cdef Promise_cFollyUnit inst = Promise_cFollyUnit.__new__(Promise_cFollyUnit) inst.cPromise[0] = cmove(cPromise) return inst cdef object _MyService_annotations = _py_types.MappingProxyType({ }) @cython.auto_pickle(False) cdef class MyServiceInterface( ServiceInterface ): annotations = _MyService_annotations def __cinit__(self): self._cpp_obj = cMyServiceInterface( self, get_executor() ) async def ping( self): raise NotImplementedError("async def ping is not implemented") async def getRandomData( self): raise NotImplementedError("async def getRandomData is not implemented") async def hasDataById( self, id): raise NotImplementedError("async def hasDataById is not implemented") async def getDataById( self, id): raise NotImplementedError("async def getDataById is not implemented") async def putDataById( self, id, data): raise NotImplementedError("async def putDataById is not implemented") async def lobDataById( self, id, data): raise NotImplementedError("async def lobDataById is not implemented") async def doNothing( self): raise NotImplementedError("async def doNothing is not implemented") @classmethod def __get_reflection__(cls): return _services_reflection.get_reflection__MyService(for_clients=False) @staticmethod def __get_metadata__(): cdef __fbthrift_cThriftServiceMetadataResponse response ServiceMetadata[_services_reflection.cMyServiceSvIf].gen(response) return __MetadataBox.box(cmove(deref(response.metadata_ref()))) @staticmethod def __get_thrift_name__(): return "module.MyService" cdef object _MyServicePrioParent_annotations = _py_types.MappingProxyType({ }) @cython.auto_pickle(False) cdef class MyServicePrioParentInterface( ServiceInterface ): annotations = _MyServicePrioParent_annotations def __cinit__(self): self._cpp_obj = cMyServicePrioParentInterface( self, get_executor() ) async def ping( self): raise NotImplementedError("async def ping is not implemented") async def pong( self): raise NotImplementedError("async def pong is not implemented") @classmethod def __get_reflection__(cls): return _services_reflection.get_reflection__MyServicePrioParent(for_clients=False) @staticmethod def __get_metadata__(): cdef __fbthrift_cThriftServiceMetadataResponse response ServiceMetadata[_services_reflection.cMyServicePrioParentSvIf].gen(response) return __MetadataBox.box(cmove(deref(response.metadata_ref()))) @staticmethod def __get_thrift_name__(): return "module.MyServicePrioParent" cdef object _MyServicePrioChild_annotations = _py_types.MappingProxyType({ }) @cython.auto_pickle(False) cdef class MyServicePrioChildInterface( MyServicePrioParentInterface ): annotations = _MyServicePrioChild_annotations def __cinit__(self): self._cpp_obj = cMyServicePrioChildInterface( self, get_executor() ) async def pang( self): raise NotImplementedError("async def pang is not implemented") @classmethod def __get_reflection__(cls): return _services_reflection.get_reflection__MyServicePrioChild(for_clients=False) @staticmethod def __get_metadata__(): cdef __fbthrift_cThriftServiceMetadataResponse response ServiceMetadata[_services_reflection.cMyServicePrioChildSvIf].gen(response) return __MetadataBox.box(cmove(deref(response.metadata_ref()))) @staticmethod def __get_thrift_name__(): return "module.MyServicePrioChild" cdef object _BadService_annotations = _py_types.MappingProxyType({ }) @cython.auto_pickle(False) cdef class BadServiceInterface( ServiceInterface ): annotations = _BadService_annotations def __cinit__(self): self._cpp_obj = cBadServiceInterface( self, get_executor() ) async def bar( self): raise NotImplementedError("async def bar is not implemented") @classmethod def __get_reflection__(cls): return _services_reflection.get_reflection__BadService(for_clients=False) @staticmethod def __get_metadata__(): cdef __fbthrift_cThriftServiceMetadataResponse response ServiceMetadata[_services_reflection.cGoodServiceSvIf].gen(response) return __MetadataBox.box(cmove(deref(response.metadata_ref()))) @staticmethod def __get_thrift_name__(): return "module.BadService" cdef object _FooBarBazService_annotations = _py_types.MappingProxyType({ }) @cython.auto_pickle(False) cdef class FooBarBazServiceInterface( ServiceInterface ): annotations = _FooBarBazService_annotations def __cinit__(self): self._cpp_obj = cFooBarBazServiceInterface( self, get_executor() ) async def foo( self): raise NotImplementedError("async def foo is not implemented") async def bar( self): raise NotImplementedError("async def bar is not implemented") async def baz( self): raise NotImplementedError("async def baz is not implemented") @classmethod def __get_reflection__(cls): return _services_reflection.get_reflection__FooBarBazService(for_clients=False) @staticmethod def __get_metadata__(): cdef __fbthrift_cThriftServiceMetadataResponse response ServiceMetadata[_services_reflection.cFooBarBazServiceSvIf].gen(response) return __MetadataBox.box(cmove(deref(response.metadata_ref()))) @staticmethod def __get_thrift_name__(): return "module.FooBarBazService" cdef api void call_cy_MyService_ping( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_ping_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_getRandomData( object self, Cpp2RequestContext* ctx, cFollyPromise[unique_ptr[string]] cPromise ) noexcept: cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_getRandomData_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_hasDataById( object self, Cpp2RequestContext* ctx, cFollyPromise[cbool] cPromise, cint64_t id ) noexcept: cdef Promise_cbool __promise = Promise_cbool._fbthrift_create(cmove(cPromise)) arg_id = id __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_hasDataById_coro( self, __promise, arg_id ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_getDataById( object self, Cpp2RequestContext* ctx, cFollyPromise[unique_ptr[string]] cPromise, cint64_t id ) noexcept: cdef Promise_string __promise = Promise_string._fbthrift_create(cmove(cPromise)) arg_id = id __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_getDataById_coro( self, __promise, arg_id ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_putDataById( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise, cint64_t id, unique_ptr[string] data ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) arg_id = id arg_data = (deref(data)).data().decode('UTF-8') __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_putDataById_coro( self, __promise, arg_id, arg_data ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_lobDataById( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise, cint64_t id, unique_ptr[string] data ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) arg_id = id arg_data = (deref(data)).data().decode('UTF-8') __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_lobDataById_coro( self, __promise, arg_id, arg_data ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_doNothing( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyService_doNothing_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyService_onStartServing( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyService_onStartServing_coro( self, __promise ) ) cdef api void call_cy_MyService_onStopRequested( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyService_onStopRequested_coro( self, __promise ) ) async def MyService_ping_coro( object self, Promise_cFollyUnit promise ): try: result = await self.ping() except _module_types.MyException as ex: promise.cPromise.setException(deref((<_module_types.MyException> ex)._cpp_obj)) except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.ping:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.ping:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyService_getRandomData_coro( object self, Promise_string promise ): try: result = await self.getRandomData() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.getRandomData:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.getRandomData:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) async def MyService_hasDataById_coro( object self, Promise_cbool promise, id ): try: result = await self.hasDataById( id) except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.hasDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.hasDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue( result) async def MyService_getDataById_coro( object self, Promise_string promise, id ): try: result = await self.getDataById( id) except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.getDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.getDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(make_unique[string]( result.encode('UTF-8'))) async def MyService_putDataById_coro( object self, Promise_cFollyUnit promise, id, data ): try: result = await self.putDataById( id, data) except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.putDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.putDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyService_lobDataById_coro( object self, Promise_cFollyUnit promise, id, data ): try: result = await self.lobDataById( id, data) except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.lobDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.lobDataById:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyService_doNothing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.doNothing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.doNothing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.doNothing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyService_onStartServing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStartServing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyService_onStopRequested_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStopRequested() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) cdef api void call_cy_MyServicePrioParent_ping( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyServicePrioParent_ping_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyServicePrioParent_pong( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyServicePrioParent_pong_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyServicePrioParent_onStartServing( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyServicePrioParent_onStartServing_coro( self, __promise ) ) cdef api void call_cy_MyServicePrioParent_onStopRequested( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyServicePrioParent_onStopRequested_coro( self, __promise ) ) async def MyServicePrioParent_ping_coro( object self, Promise_cFollyUnit promise ): try: result = await self.ping() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioParent.ping:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioParent.ping:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyServicePrioParent_pong_coro( object self, Promise_cFollyUnit promise ): try: result = await self.pong() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioParent.pong:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioParent.pong:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyServicePrioParent_onStartServing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStartServing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioParent.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioParent.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyServicePrioParent_onStopRequested_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStopRequested() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioParent.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioParent.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) cdef api void call_cy_MyServicePrioChild_pang( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( MyServicePrioChild_pang_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_MyServicePrioChild_onStartServing( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyServicePrioChild_onStartServing_coro( self, __promise ) ) cdef api void call_cy_MyServicePrioChild_onStopRequested( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( MyServicePrioChild_onStopRequested_coro( self, __promise ) ) async def MyServicePrioChild_pang_coro( object self, Promise_cFollyUnit promise ): try: result = await self.pang() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioChild.pang:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioChild.pang:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyServicePrioChild_onStartServing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStartServing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioChild.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioChild.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def MyServicePrioChild_onStopRequested_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStopRequested() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler MyServicePrioChild.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler MyServicePrioChild.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) cdef api void call_cy_BadService_bar( object self, Cpp2RequestContext* ctx, cFollyPromise[cint32_t] cPromise ) noexcept: cdef Promise_cint32_t __promise = Promise_cint32_t._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( BadService_bar_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_BadService_onStartServing( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( BadService_onStartServing_coro( self, __promise ) ) cdef api void call_cy_BadService_onStopRequested( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( BadService_onStopRequested_coro( self, __promise ) ) async def BadService_bar_coro( object self, Promise_cint32_t promise ): try: result = await self.bar() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler BadService.bar:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler BadService.bar:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue( result) async def BadService_onStartServing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStartServing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler BadService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler BadService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def BadService_onStopRequested_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStopRequested() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler BadService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler BadService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) cdef api void call_cy_FooBarBazService_foo( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( FooBarBazService_foo_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_FooBarBazService_bar( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( FooBarBazService_bar_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_FooBarBazService_baz( object self, Cpp2RequestContext* ctx, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) __context = RequestContext._fbthrift_create(ctx) __context_token = __THRIFT_REQUEST_CONTEXT.set(__context) asyncio.get_event_loop().create_task( FooBarBazService_baz_coro( self, __promise ) ) __THRIFT_REQUEST_CONTEXT.reset(__context_token) cdef api void call_cy_FooBarBazService_onStartServing( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( FooBarBazService_onStartServing_coro( self, __promise ) ) cdef api void call_cy_FooBarBazService_onStopRequested( object self, cFollyPromise[cFollyUnit] cPromise ) noexcept: cdef Promise_cFollyUnit __promise = Promise_cFollyUnit._fbthrift_create(cmove(cPromise)) asyncio.get_event_loop().create_task( FooBarBazService_onStopRequested_coro( self, __promise ) ) async def FooBarBazService_foo_coro( object self, Promise_cFollyUnit promise ): try: result = await self.foo() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler FooBarBazService.foo:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler FooBarBazService.foo:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def FooBarBazService_bar_coro( object self, Promise_cFollyUnit promise ): try: result = await self.bar() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler FooBarBazService.bar:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler FooBarBazService.bar:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def FooBarBazService_baz_coro( object self, Promise_cFollyUnit promise ): try: result = await self.baz() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler FooBarBazService.baz:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler FooBarBazService.baz:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def FooBarBazService_onStartServing_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStartServing() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler FooBarBazService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler FooBarBazService.onStartServing:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit) async def FooBarBazService_onStopRequested_coro( object self, Promise_cFollyUnit promise ): try: result = await self.onStopRequested() except __ApplicationError as ex: # If the handler raised an ApplicationError convert it to a C++ one promise.cPromise.setException(cTApplicationException( ex.type.value, ex.message.encode('UTF-8') )) except Exception as ex: print( "Unexpected error in service handler FooBarBazService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, repr(ex).encode('UTF-8') )) except asyncio.CancelledError as ex: print("Coroutine was cancelled in service handler FooBarBazService.onStopRequested:", file=sys.stderr) traceback.print_exc() promise.cPromise.setException(cTApplicationException( cTApplicationExceptionType__UNKNOWN, (f'Application was cancelled on the server with message: {str(ex)}').encode('UTF-8') )) else: promise.cPromise.setValue(c_unit)