Replace references to kargs with kwargs
authorHarmon <Harmon758@gmail.com>
Sun, 25 Aug 2019 08:20:13 +0000 (03:20 -0500)
committerHarmon <Harmon758@gmail.com>
Sun, 25 Aug 2019 08:20:13 +0000 (03:20 -0500)
tests/test_cursors.py
tweepy/api.py
tweepy/cursor.py
tweepy/models.py

index ebd8cbec4e4d3e3664bb521637b9c553246c43bc..3f461574375fcbc2254996b6a6787c0a3a3db51a 100644 (file)
@@ -33,7 +33,7 @@ class TweepyCursorTests(TweepyTestCase):
     def testcursorsetstartcursor(self):
         c = Cursor(self.api.friends_ids, cursor=123456)
         self.assertEqual(c.iterator.next_cursor, 123456)
-        self.assertFalse('cursor' in c.iterator.kargs)
+        self.assertFalse('cursor' in c.iterator.kwargs)
 
     @tape.use_cassette('testcursornext.json')
     def testcursornext(self):
index 9cd14a15a00937e07223280885f338be71e8a76a..fa9f4226f577c928606a076ee0e9558d2ec67a0b 100644 (file)
@@ -591,7 +591,7 @@ class API(object):
             use_cache=False
         )
 
-    def verify_credentials(self, **kargs):
+    def verify_credentials(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials
             :allowed_param:'include_entities', 'skip_status', 'include_email'
         """
@@ -602,7 +602,7 @@ class API(object):
                 payload_type='user',
                 require_auth=True,
                 allowed_param=['include_entities', 'skip_status', 'include_email'],
-            )(**kargs)
+            )(**kwargs)
         except TweepError as e:
             if e.response and e.response.status == 401:
                 return False
@@ -635,11 +635,11 @@ class API(object):
             require_auth=True
         )(self, post_data=post_data, headers=headers)
 
-    def update_profile_background_image(self, filename, **kargs):
+    def update_profile_background_image(self, filename, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_background_image
             :allowed_param:'tile', 'include_entities', 'skip_status', 'use'
         """
-        f = kargs.pop('file', None)
+        f = kwargs.pop('file', None)
         headers, post_data = API._pack_image(filename, 800, f=f)
         return bind_api(
             api=self,
@@ -650,11 +650,11 @@ class API(object):
             require_auth=True
         )(post_data=post_data, headers=headers)
 
-    def update_profile_banner(self, filename, **kargs):
+    def update_profile_banner(self, filename, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_banner
             :allowed_param:'width', 'height', 'offset_left', 'offset_right'
         """
-        f = kargs.pop('file', None)
+        f = kwargs.pop('file', None)
         headers, post_data = API._pack_image(filename, 700, form_field="banner", f=f)
         return bind_api(
             api=self,
index 746b1e85d01619ad8e8d4e4d315b41e102097f0d..2f0cf2de75ed57108e355e3b1f67f9347b0e5a65 100644 (file)
@@ -9,14 +9,14 @@ from tweepy.parsers import ModelParser, RawParser
 class Cursor(object):
     """Pagination helper class"""
 
-    def __init__(self, method, *args, **kargs):
+    def __init__(self, method, *args, **kwargs):
         if hasattr(method, 'pagination_mode'):
             if method.pagination_mode == 'cursor':
-                self.iterator = CursorIterator(method, args, kargs)
+                self.iterator = CursorIterator(method, args, kwargs)
             elif method.pagination_mode == 'id':
-                self.iterator = IdIterator(method, args, kargs)
+                self.iterator = IdIterator(method, args, kwargs)
             elif method.pagination_mode == 'page':
-                self.iterator = PageIterator(method, args, kargs)
+                self.iterator = PageIterator(method, args, kwargs)
             else:
                 raise TweepError('Invalid pagination mode.')
         else:
@@ -37,10 +37,10 @@ class Cursor(object):
 
 class BaseIterator(object):
 
-    def __init__(self, method, args, kargs):
+    def __init__(self, method, args, kwargs):
         self.method = method
         self.args = args
-        self.kargs = kargs
+        self.kwargs = kwargs
         self.limit = 0
 
     def __next__(self):
@@ -58,9 +58,9 @@ class BaseIterator(object):
 
 class CursorIterator(BaseIterator):
 
-    def __init__(self, method, args, kargs):
-        BaseIterator.__init__(self, method, args, kargs)
-        start_cursor = kargs.pop('cursor', None)
+    def __init__(self, method, args, kwargs):
+        BaseIterator.__init__(self, method, args, kwargs)
+        start_cursor = kwargs.pop('cursor', None)
         self.next_cursor = start_cursor or -1
         self.prev_cursor = start_cursor or 0
         self.num_tweets = 0
@@ -70,7 +70,7 @@ class CursorIterator(BaseIterator):
             raise StopIteration
         data, cursors = self.method(cursor=self.next_cursor,
                                     *self.args,
-                                    **self.kargs)
+                                    **self.kwargs)
         self.prev_cursor, self.next_cursor = cursors
         if len(data) == 0:
             raise StopIteration
@@ -82,16 +82,16 @@ class CursorIterator(BaseIterator):
             raise TweepError('Can not page back more, at first page')
         data, self.next_cursor, self.prev_cursor = self.method(cursor=self.prev_cursor,
                                                                *self.args,
-                                                               **self.kargs)
+                                                               **self.kwargs)
         self.num_tweets -= 1
         return data
 
 
 class IdIterator(BaseIterator):
 
-    def __init__(self, method, args, kargs):
-        BaseIterator.__init__(self, method, args, kargs)
-        self.max_id = kargs.pop('max_id', None)
+    def __init__(self, method, args, kwargs):
+        BaseIterator.__init__(self, method, args, kwargs)
+        self.max_id = kwargs.pop('max_id', None)
         self.num_tweets = 0
         self.results = []
         self.model_results = []
@@ -103,7 +103,7 @@ class IdIterator(BaseIterator):
             raise StopIteration
 
         if self.index >= len(self.results) - 1:
-            data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)
+            data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kwargs)
 
             if hasattr(self.method, '__self__'):
                 old_parser = self.method.__self__.parser
@@ -155,8 +155,8 @@ class IdIterator(BaseIterator):
 
 class PageIterator(BaseIterator):
 
-    def __init__(self, method, args, kargs):
-        BaseIterator.__init__(self, method, args, kargs)
+    def __init__(self, method, args, kwargs):
+        BaseIterator.__init__(self, method, args, kwargs)
         self.current_page = 0
 
     def next(self):
@@ -164,7 +164,7 @@ class PageIterator(BaseIterator):
             if self.current_page > self.limit:
                 raise StopIteration
 
-        items = self.method(page=self.current_page, *self.args, **self.kargs)
+        items = self.method(page=self.current_page, *self.args, **self.kwargs)
         if len(items) == 0:
             raise StopIteration
         self.current_page += 1
@@ -174,7 +174,7 @@ class PageIterator(BaseIterator):
         if self.current_page == 1:
             raise TweepError('Can not page back more, at first page')
         self.current_page -= 1
-        return self.method(page=self.current_page, *self.args, **self.kargs)
+        return self.method(page=self.current_page, *self.args, **self.kwargs)
 
 
 class ItemIterator(BaseIterator):
index 09ac79de70ebc9dbcb7aa18342d46354d801cc84..7c33d8f52453d2d4c8f54d0fac35493af18da013 100644 (file)
@@ -174,14 +174,14 @@ class User(Model):
             results.append(cls.parse(api, obj))
         return results
 
-    def timeline(self, **kargs):
-        return self._api.user_timeline(user_id=self.id, **kargs)
+    def timeline(self, **kwargs):
+        return self._api.user_timeline(user_id=self.id, **kwargs)
 
-    def friends(self, **kargs):
-        return self._api.friends(user_id=self.id, **kargs)
+    def friends(self, **kwargs):
+        return self._api.friends(user_id=self.id, **kwargs)
 
-    def followers(self, **kargs):
-        return self._api.followers(user_id=self.id, **kargs)
+    def followers(self, **kwargs):
+        return self._api.followers(user_id=self.id, **kwargs)
 
     def follow(self):
         self._api.create_friendship(user_id=self.id)
@@ -191,25 +191,25 @@ class User(Model):
         self._api.destroy_friendship(user_id=self.id)
         self.following = False
 
-    def lists_memberships(self, *args, **kargs):
+    def lists_memberships(self, *args, **kwargs):
         return self._api.lists_memberships(user=self.screen_name,
                                            *args,
-                                           **kargs)
+                                           **kwargs)
 
-    def lists_subscriptions(self, *args, **kargs):
+    def lists_subscriptions(self, *args, **kwargs):
         return self._api.lists_subscriptions(user=self.screen_name,
                                              *args,
-                                             **kargs)
+                                             **kwargs)
 
-    def lists(self, *args, **kargs):
+    def lists(self, *args, **kwargs):
         return self._api.lists_all(user=self.screen_name,
                                    *args,
-                                   **kargs)
+                                   **kwargs)
 
-    def followers_ids(self, *args, **kargs):
+    def followers_ids(self, *args, **kwargs):
         return self._api.followers_ids(user_id=self.id,
                                        *args,
-                                       **kargs)
+                                       **kwargs)
 
     def __eq__(self, other):
         if isinstance(other, User):
@@ -333,16 +333,16 @@ class List(Model):
             results.append(cls.parse(api, obj))
         return results
 
-    def update(self, **kargs):
-        return self._api.update_list(self.slug, **kargs)
+    def update(self, **kwargs):
+        return self._api.update_list(self.slug, **kwargs)
 
     def destroy(self):
         return self._api.destroy_list(self.slug)
 
-    def timeline(self, **kargs):
+    def timeline(self, **kwargs):
         return self._api.list_timeline(self.user.screen_name,
                                        self.slug,
-                                       **kargs)
+                                       **kwargs)
 
     def add_member(self, id):
         return self._api.add_list_member(self.slug, id)
@@ -350,10 +350,10 @@ class List(Model):
     def remove_member(self, id):
         return self._api.remove_list_member(self.slug, id)
 
-    def members(self, **kargs):
+    def members(self, **kwargs):
         return self._api.list_members(self.user.screen_name,
                                       self.slug,
-                                      **kargs)
+                                      **kwargs)
 
     def is_member(self, id):
         return self._api.is_list_member(self.user.screen_name,
@@ -366,10 +366,10 @@ class List(Model):
     def unsubscribe(self):
         return self._api.unsubscribe_list(self.user.screen_name, self.slug)
 
-    def subscribers(self, **kargs):
+    def subscribers(self, **kwargs):
         return self._api.list_subscribers(self.user.screen_name,
                                           self.slug,
-                                          **kargs)
+                                          **kwargs)
 
     def is_subscribed(self, id):
         return self._api.is_subscribed_list(self.user.screen_name,