Parsely / pykafka

Apache Kafka client for Python; high-level & low-level consumer/producer, with great performance.
http://pykafka.readthedocs.org/
Apache License 2.0
1.12k stars 232 forks source link

Use functools to mark the _check_handler decorator as a wrapper #1000

Open spenczar opened 4 years ago

spenczar commented 4 years ago

Using @functools.wrap ensures that docstrings for wrapped functions are passed through the decorator correctly.

Before:

$  pydoc pykafka.broker.Broker.create_topics
Help on function wrapped in pykafka.broker.Broker:

pykafka.broker.Broker.create_topics = wrapped(self, *args, **kwargs)

After:

$ pydoc pykafka.broker.Broker.create_topics

pykafka.broker.Broker.create_topics = create_topics(self, topic_reqs, timeout=0)
    Create topics via the Topic Creation API

    :param topic_reqs: The topic creation requests to issue
    :type topics: Iterable of :class:`pykafka.protocol.CreateTopicRequest`
    :param timeout: The time in ms to wait for a topic to be completely created.
        Values <= 0 will trigger topic creation and return immediately.
    :type timeout: int

I've also noticed that the wrapped topic API methods don't appear in the RTD documentation. This might fix that, but I'm not sure.