From e0ff4bb29610ebe354a0bd619f1c7be4cf03024d Mon Sep 17 00:00:00 2001 From: rnpridgeon Date: Wed, 6 Jun 2018 21:57:57 -0400 Subject: [PATCH 1/2] Fix constructor doc (#231) --- confluent_kafka/src/Consumer.c | 2 +- confluent_kafka/src/Producer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_kafka/src/Consumer.c b/confluent_kafka/src/Consumer.c index 54b502f3e..ef356a480 100644 --- a/confluent_kafka/src/Consumer.c +++ b/confluent_kafka/src/Consumer.c @@ -1413,7 +1413,7 @@ PyTypeObject ConsumerType = { Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "High-level Kafka Consumer\n" "\n" - ".. py:function:: Consumer(**kwargs)\n" + ".. py:function:: Consumer(config, **kwargs)\n" "\n" " Create new Consumer instance using provided configuration dict.\n" "\n" diff --git a/confluent_kafka/src/Producer.c b/confluent_kafka/src/Producer.c index 07c2ba30c..55c353ea9 100644 --- a/confluent_kafka/src/Producer.c +++ b/confluent_kafka/src/Producer.c @@ -635,7 +635,7 @@ PyTypeObject ProducerType = { Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "Asynchronous Kafka Producer\n" "\n" - ".. py:function:: Producer(**kwargs)\n" + ".. py:function:: Producer(config, **kwargs)\n" "\n" " Create new Producer instance using provided configuration dict.\n" "\n" From 9785ef3aee412a372e49683b53ab9fc2966c3595 Mon Sep 17 00:00:00 2001 From: rnpridgeon Date: Thu, 7 Jun 2018 13:48:30 -0400 Subject: [PATCH 2/2] address review issues --- confluent_kafka/src/Consumer.c | 41 ++++++++++++++++++---------------- confluent_kafka/src/Producer.c | 26 +++++++++++---------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/confluent_kafka/src/Consumer.c b/confluent_kafka/src/Consumer.c index ef356a480..34358092b 100644 --- a/confluent_kafka/src/Consumer.c +++ b/confluent_kafka/src/Consumer.c @@ -1411,25 +1411,28 @@ PyTypeObject ConsumerType = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "High-level Kafka Consumer\n" - "\n" - ".. py:function:: Consumer(config, **kwargs)\n" - "\n" - " Create new Consumer instance using provided configuration dict.\n" - "\n" - " Special configuration properties:\n" - " ``on_commit``: Optional callback will be called when a commit " - "request has succeeded or failed.\n" - "\n" - "\n" - ".. py:function:: on_commit(err, partitions)\n" - "\n" - " :param Consumer consumer: Consumer instance.\n" - " :param KafkaError err: Commit error object, or None on success.\n" - " :param list(TopicPartition) partitions: List of partitions with " - "their committed offsets or per-partition errors.\n" - "\n" - "\n", /*tp_doc*/ + "High-level Kafka Consumer\n" + "\n" + ".. py:function:: Consumer(config)\n" + "\n" + " :param dict config: Configuration properties. At a minimum ``bootstrap.servers`` and " + "``group.id`` **should** be set" + "\n" + "Create new Consumer instance using provided configuration dict.\n" + "\n" + " Special configuration properties:\n" + " ``on_commit``: Optional callback will be called when a commit " + "request has succeeded or failed.\n" + "\n" + "\n" + ".. py:function:: on_commit(err, partitions)\n" + "\n" + " :param Consumer consumer: Consumer instance.\n" + " :param KafkaError err: Commit error object, or None on success.\n" + " :param list(TopicPartition) partitions: List of partitions with " + "their committed offsets or per-partition errors.\n" + "\n" + "\n", /*tp_doc*/ (traverseproc)Consumer_traverse, /* tp_traverse */ (inquiry)Consumer_clear, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/confluent_kafka/src/Producer.c b/confluent_kafka/src/Producer.c index 55c353ea9..a23d9e3ea 100644 --- a/confluent_kafka/src/Producer.c +++ b/confluent_kafka/src/Producer.c @@ -633,18 +633,20 @@ PyTypeObject ProducerType = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "Asynchronous Kafka Producer\n" - "\n" - ".. py:function:: Producer(config, **kwargs)\n" - "\n" - " Create new Producer instance using provided configuration dict.\n" - "\n" - "\n" - ".. py:function:: len()\n" - "\n" - " :returns: Number of messages and Kafka protocol requests waiting to be delivered to broker.\n" - " :rtype: int\n" - "\n", /*tp_doc*/ + "Asynchronous Kafka Producer\n" + "\n" + ".. py:function:: Producer(config)\n" + "\n" + " :param dict config: Configuration properties. At a minimum ``bootstrap.servers`` **should** be set\n" + "\n" + " Create new Producer instance using provided configuration dict.\n" + "\n" + "\n" + ".. py:function:: len()\n" + "\n" + " :returns: Number of messages and Kafka protocol requests waiting to be delivered to broker.\n" + " :rtype: int\n" + "\n", /*tp_doc*/ (traverseproc)Producer_traverse, /* tp_traverse */ (inquiry)Producer_clear, /* tp_clear */ 0, /* tp_richcompare */