Add client_streaming and server_streaming in MethodDescriptor for upb python

PiperOrigin-RevId: 573268712
pull/14365/head
Jie Luo 1 year ago committed by Copybara-Service
parent 6e848b00c9
commit 8c8cbc43a7
  1. 16
      python/descriptor.c

@ -1441,6 +1441,18 @@ static PyObject* PyUpb_MethodDescriptor_GetOutputType(PyObject* self,
return PyUpb_Descriptor_Get(upb_MethodDef_OutputType(m));
}
static PyObject* PyUpb_MethodDescriptor_GetClientStreaming(PyObject* self,
void* closure) {
const upb_MethodDef* m = PyUpb_MethodDescriptor_GetDef(self);
return PyBool_FromLong(upb_MethodDef_ClientStreaming(m) ? 1 : 0);
}
static PyObject* PyUpb_MethodDescriptor_GetServerStreaming(PyObject* self,
void* closure) {
const upb_MethodDef* m = PyUpb_MethodDescriptor_GetDef(self);
return PyBool_FromLong(upb_MethodDef_ServerStreaming(m) ? 1 : 0);
}
static PyObject* PyUpb_MethodDescriptor_GetOptions(PyObject* _self,
PyObject* args) {
PyUpb_DescriptorBase* self = (void*)_self;
@ -1467,6 +1479,10 @@ static PyGetSetDef PyUpb_MethodDescriptor_Getters[] = {
NULL},
{"output_type", PyUpb_MethodDescriptor_GetOutputType, NULL, "Output type",
NULL},
{"client_streaming", PyUpb_MethodDescriptor_GetClientStreaming, NULL,
"Client streaming", NULL},
{"server_streaming", PyUpb_MethodDescriptor_GetServerStreaming, NULL,
"Server streaming", NULL},
{NULL}};
static PyMethodDef PyUpb_MethodDescriptor_Methods[] = {

Loading…
Cancel
Save