Skip to content
This repository was 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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use functools to mark the _check_handler decorator as a wrapper
Using @functools.wrap ensures that docstrings for wrapped functions
are passed through the decorator correctly.
spenczar committed May 7, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 723c3f9fd209a2e92832a3453ec07c03d0b6df8c
2 changes: 2 additions & 0 deletions pykafka/broker.py
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
limitations under the License.
"""
__all__ = ["Broker"]
import functools
import logging
import time

@@ -39,6 +40,7 @@

def _check_handler(fn):
"""Ensures that self._req_handler is not None before calling fn"""
@functools.wraps(fn)
def wrapped(self, *args, **kwargs):
if self._req_handler is None:
raise SocketDisconnectedError