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.
Using @functools.wrap ensures that docstrings for wrapped functions are passed through the decorator correctly.
Before:
After:
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.