Update and improve documentation for API.lists_memberships
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:05:34 +0000 (10:05 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:05:34 +0000 (10:05 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Improve parameter order in documentation

docs/api.rst
tweepy/api.py

index bae5466a7724cf316452c7e154e0a9a84e4b6437..1f85bb5e0e41a2a04fbaf19164ff89b689ea2acc 100644 (file)
@@ -76,6 +76,8 @@ Create and manage lists
 
 .. automethod:: API.show_list_member
 
+.. automethod:: API.lists_memberships
+
 
 User methods
 ------------
@@ -620,23 +622,6 @@ List Methods
    :rtype: :class:`List` object
 
 
-.. method:: API.lists_memberships([screen_name], [user_id], \
-                                  [filter_to_owned_lists], [cursor], [count])
-
-   Returns the lists the specified user has been added to. If ``user_id`` or
-   ``screen_name`` are not provided, the memberships for the authenticating
-   user are returned.
-
-   :param screen_name: |screen_name|
-   :param user_id: |user_id|
-   :param filter_to_owned_lists: A boolean indicating whether to return just
-      lists the authenticating user owns, and the user represented by
-      ``user_id`` or ``screen_name`` is a member of.
-   :param cursor: |cursor|
-   :param count: |count|
-   :rtype: list of :class:`List` objects
-
-
 .. method:: API.lists_ownerships([user_id], [screen_name], [count], [cursor])
 
    Returns the lists owned by the specified user. Private lists will only be
index 29bd193c6a756c276691d27860e03aa5f0732932..9dd4790a65d1945252ef74e6680ce4d5c60d9d3b 100644 (file)
@@ -960,6 +960,35 @@ class API:
             ), **kwargs
         )
 
+    @pagination(mode='cursor')
+    @payload('list', list=True)
+    def lists_memberships(self, **kwargs):
+        """lists_memberships(user_id, screen_name, count, cursor, \
+                             filter_to_owned_lists)
+
+        Returns the lists the specified user has been added to. If ``user_id``
+        or ``screen_name`` are not provided, the memberships for the
+        authenticating user are returned.
+
+        :param user_id: |user_id|
+        :param screen_name: |screen_name|
+        :param count: |count|
+        :param cursor: |cursor|
+        :param filter_to_owned_lists: A boolean indicating whether to return
+            just lists the authenticating user owns, and the user represented
+            by ``user_id`` or ``screen_name`` is a member of.
+
+        :rtype: list of :class:`List` objects
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships
+        """
+        return self.request(
+            'GET', 'lists/memberships', endpoint_parameters=(
+                'user_id', 'screen_name', 'count', 'cursor',
+                'filter_to_owned_lists'
+            ), **kwargs
+        )
+
     def media_upload(self, filename, *, file=None, chunked=False,
                      media_category=None, additional_owners=None, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview
@@ -1567,18 +1596,6 @@ class API:
             ), **kwargs
         )
 
-    @pagination(mode='cursor')
-    @payload('list', list=True)
-    def lists_memberships(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-memberships
-        """
-        return self.request(
-            'GET', 'lists/memberships', endpoint_parameters=(
-                'user_id', 'screen_name', 'count', 'cursor',
-                'filter_to_owned_lists'
-            ), **kwargs
-        )
-
     @pagination(mode='cursor')
     @payload('list', list=True)
     def lists_ownerships(self, **kwargs):