From cb93b79a58497c1e644ce107680c3fd8be895a48 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 3 Feb 2021 11:28:42 -0600 Subject: [PATCH] Remove binder.py Move pagination and payload decorator definitions to api.py --- tweepy/api.py | 21 ++++++++++++++++++++- tweepy/binder.py | 23 ----------------------- 2 files changed, 20 insertions(+), 24 deletions(-) delete mode 100644 tweepy/binder.py diff --git a/tweepy/api.py b/tweepy/api.py index 4cd8689..545ab61 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -12,7 +12,6 @@ from urllib.parse import urlencode import requests -from tweepy.binder import pagination, payload from tweepy.error import is_rate_limit_error_message, RateLimitError, TweepError from tweepy.models import Model from tweepy.parsers import ModelParser, Parser @@ -21,6 +20,26 @@ from tweepy.utils import list_to_csv log = logging.getLogger(__name__) +def pagination(mode): + def decorator(method): + method.pagination_mode = mode + return method + return decorator + + +def payload(payload_type, **payload_kwargs): + payload_list = payload_kwargs.get('list', False) + def decorator(method): + def wrapper(*args, **kwargs): + kwargs['payload_list'] = payload_list + kwargs['payload_type'] = payload_type + return method(*args, **kwargs) + wrapper.payload_list = payload_list + wrapper.payload_type = payload_type + return wrapper + return decorator + + class API: """Twitter API""" diff --git a/tweepy/binder.py b/tweepy/binder.py deleted file mode 100644 index f509024..0000000 --- a/tweepy/binder.py +++ /dev/null @@ -1,23 +0,0 @@ -# Tweepy -# Copyright 2009-2021 Joshua Roesslein -# See LICENSE for details. - - -def pagination(mode): - def decorator(method): - method.pagination_mode = mode - return method - return decorator - - -def payload(payload_type, **payload_kwargs): - payload_list = payload_kwargs.get('list', False) - def decorator(method): - def wrapper(*args, **kwargs): - kwargs['payload_list'] = payload_list - kwargs['payload_type'] = payload_type - return method(*args, **kwargs) - wrapper.payload_list = payload_list - wrapper.payload_type = payload_type - return wrapper - return decorator -- 2.25.1