From 4598534b929d6b918152b852b1edcb6cc92e7fe0 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 26 Dec 2020 02:14:56 -0600 Subject: [PATCH] Remove subclassing of object --- tests/test_resultset.py | 4 ++-- tweepy/api.py | 2 +- tweepy/auth.py | 2 +- tweepy/binder.py | 2 +- tweepy/cache.py | 2 +- tweepy/cursor.py | 4 ++-- tweepy/models.py | 4 ++-- tweepy/parsers.py | 2 +- tweepy/streaming.py | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_resultset.py b/tests/test_resultset.py index b9141ee..861f3a5 100644 --- a/tests/test_resultset.py +++ b/tests/test_resultset.py @@ -2,9 +2,9 @@ from .config import TweepyTestCase from tweepy.models import ResultSet -class NoIdItem(object): pass +class NoIdItem: pass -class IdItem(object): +class IdItem: def __init__(self, id): self.id = id diff --git a/tweepy/api.py b/tweepy/api.py index 72411b0..0a4ccd0 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -12,7 +12,7 @@ from tweepy.parsers import ModelParser, Parser from tweepy.utils import list_to_csv -class API(object): +class API: """Twitter API""" def __init__(self, auth_handler=None, diff --git a/tweepy/auth.py b/tweepy/auth.py index 271c77c..7e82b40 100644 --- a/tweepy/auth.py +++ b/tweepy/auth.py @@ -19,7 +19,7 @@ https://dev.twitter.com/discussions/21281""" log = logging.getLogger(__name__) -class AuthHandler(object): +class AuthHandler: def apply_auth(self, url, method, headers, parameters): """Apply authentication headers to request""" diff --git a/tweepy/binder.py b/tweepy/binder.py index b323aed..0897425 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -22,7 +22,7 @@ log = logging.getLogger(__name__) def bind_api(**config): - class APIMethod(object): + class APIMethod: api = config['api'] path = config['path'] diff --git a/tweepy/cache.py b/tweepy/cache.py index ab0135a..f24a101 100644 --- a/tweepy/cache.py +++ b/tweepy/cache.py @@ -24,7 +24,7 @@ except ImportError: log = logging.getLogger(__name__) -class Cache(object): +class Cache: """Cache interface""" def __init__(self, timeout=60): diff --git a/tweepy/cursor.py b/tweepy/cursor.py index a488d37..85eabce 100644 --- a/tweepy/cursor.py +++ b/tweepy/cursor.py @@ -6,7 +6,7 @@ from tweepy.error import TweepError from tweepy.parsers import ModelParser, RawParser -class Cursor(object): +class Cursor: """Pagination helper class""" def __init__(self, method, *args, **kwargs): @@ -39,7 +39,7 @@ class Cursor(object): return i -class BaseIterator(object): +class BaseIterator: def __init__(self, method, *args, **kwargs): self.method = method diff --git a/tweepy/models.py b/tweepy/models.py index 2d0239d..a734acb 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -32,7 +32,7 @@ class ResultSet(list): return [item.id for item in self if hasattr(item, 'id')] -class Model(object): +class Model: def __init__(self, api=None): self._api = api @@ -503,7 +503,7 @@ class Media(Model): return media -class ModelFactory(object): +class ModelFactory: """ Used by parsers for creating instances of models. You may subclass this factory diff --git a/tweepy/parsers.py b/tweepy/parsers.py index a526efb..cd2fb8b 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -8,7 +8,7 @@ from tweepy.error import TweepError from tweepy.models import ModelFactory -class Parser(object): +class Parser: def parse(self, method, payload, *args, **kwargs): """ diff --git a/tweepy/streaming.py b/tweepy/streaming.py index 3bb54aa..d77cdaa 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -25,7 +25,7 @@ STREAM_VERSION = '1.1' log = logging.getLogger(__name__) -class StreamListener(object): +class StreamListener: def __init__(self, api=None): self.api = api or API() @@ -154,7 +154,7 @@ class StreamListener(object): """Called when a user withheld content notice arrives""" return -class ReadBuffer(object): +class ReadBuffer: """Buffer data from the response in a smarter way than httplib/requests can. Tweets are roughly in the 2-12kb range, averaging around 3kb. @@ -204,7 +204,7 @@ class ReadBuffer(object): return r.decode(self._encoding) -class Stream(object): +class Stream: def __init__(self, auth, listener, **options): self.auth = auth -- 2.25.1