Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spenczar
Copy link

@spenczar spenczar commented May 7, 2020

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant