From bd71027548ea5bb957ce7281a7b55a043f4dd468 Mon Sep 17 00:00:00 2001 From: Harmon Date: Tue, 6 Apr 2021 11:02:00 -0500 Subject: [PATCH] Properly wrap methods with pagination and payload decorators --- tweepy/api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 5ea831f..f065181 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2,6 +2,7 @@ # Copyright 2009-2021 Joshua Roesslein # See LICENSE for details. +import functools import imghdr import logging import mimetypes @@ -25,14 +26,18 @@ log = logging.getLogger(__name__) def pagination(mode): def decorator(method): - method.pagination_mode = mode - return method + @functools.wraps(method) + def wrapper(*args, **kwargs): + return method(*args, **kwargs) + wrapper.pagination_mode = mode + return wrapper return decorator def payload(payload_type, **payload_kwargs): payload_list = payload_kwargs.get('list', False) def decorator(method): + @functools.wraps(method) def wrapper(*args, **kwargs): kwargs['payload_list'] = payload_list kwargs['payload_type'] = payload_type -- 2.25.1