* Removed `backtime` parameter from `diaspy.streams.Generic()` it's `more()` method...
authorCYBERDEViLNL <CYBERDEViLNL@github.com>
Sat, 3 Nov 2018 20:10:46 +0000 (21:10 +0100)
committerCYBERDEViLNL <CYBERDEViLNL@github.com>
Sat, 3 Nov 2018 20:10:46 +0000 (21:10 +0100)
* Some commentary updates/cleanups here and there.

diaspy/people.py
diaspy/settings.py
diaspy/streams.py

index 14a869a3676ee2b0817b35b3c4c855aef40d0c00..cebfb921307d4420e00949cb2cca7b7443eb73ce 100644 (file)
@@ -151,13 +151,20 @@ class User():
                        self.data.update( data[0] )
 
        def aspectMemberships(self):
+               """Returns a list with aspect memberships
+
+               :returns: list
+               """
                if 'contact' in self.data:
                        return self.data.get('contact', {}).get('aspect_memberships', [])
                else:
                        return self.data.get('aspect_memberships', [])
 
        def getPhotos(self):
-               """
+               """Gets and sets this User()'s photo data.
+
+               :returns: dict
+
                --> GET /people/{GUID}/photos.json HTTP/1.1
 
                <-- HTTP/1.1 200 OK
@@ -221,6 +228,9 @@ class User():
 
        def deletePhoto(self, photo_id):
                """
+               :param photo_id: Photo ID to delete.
+               :type photo_id: int
+
                --> DELETE /photos/{PHOTO_ID} HTTP/1.1
                <-- HTTP/1.1 204 No Content
                """
@@ -261,21 +271,18 @@ class Contacts():
                return self.contacts[index]
 
        def addAspect(self, name, visible=False):
-               """
-               --> POST /aspects HTTP/1.1
-               --> {"person_id":null,"name":"test","contacts_visible":false}
-
-               <-- HTTP/1.1 200 OK
-
-               Add new aspect.
-
-               TODO: status_code's
+               """Add new aspect.
 
                :param name: aspect name to add
                :type name: str
                :param visible: sets if contacts in aspect are visible for each and other
                :type visible: bool
                :returns: JSON from request
+
+               --> POST /aspects HTTP/1.1
+               --> {"person_id":null,"name":"test","contacts_visible":false}
+
+               <-- HTTP/1.1 200 OK
                """
                data = {
                        'person_id': None,
@@ -297,7 +304,11 @@ class Contacts():
                return new_aspect
 
        def deleteAspect(self, aspect_id):
-               """
+               """Deletes a aspect with given ID.
+
+               :param aspect_id: Aspect ID to delete.
+               :type aspect_id: int
+
                --> POST /aspects/{ASPECT_ID} HTTP/1.1
                        _method=delete&authenticity_token={TOKEN}
                        Content-Type: application/x-www-form-urlencoded
@@ -317,9 +328,9 @@ class Contacts():
                :type user_id: str
                :param aspect_ids: list of aspect ids
                :type aspect_ids: list
+               :returns: dict
                """
                # TODO update self.contacts
-               # Returns {"aspect_id":123,"person_id":123}
                for aid in aspect_ids:
                        new_aspect_membership = Aspect(self._connection, aid).addUser(user_id)
 
@@ -385,6 +396,8 @@ class Contacts():
 
                :param set: if passed could be 'all' or 'only_sharing'
                :type set: str
+               :param page: page number to get, default 0.
+               :type page: int
                """
                params = {}
                if set:
index 5d7f660324a3f6de87619bd7dfad0c817502c089..53d7ab5751198d54f651908226a3ecd5352f75ce 100644 (file)
@@ -120,7 +120,7 @@ class Account():
                One of the Black Magic(tm) methods.
                """
                request = self._connection.get('user/edit')
-               if BS4_SUPPORT: # TODO
+               if BS4_SUPPORT:
                        soup = BeautifulSoup(request.text, 'lxml')
                        language = soup.find('select', {"id": "user_language"})
                        return [(option.text, option['value']) for option in language.findAll('option')]
index 02c1ca5e6dc94b8fe3e4a885e6dee2a7a83ccb74..5a6a95a6a2b825480833614a3d5eb812fc8a20ea 100644 (file)
@@ -150,14 +150,9 @@ class Generic():
                """
                self._stream = self._obtain()
 
-       def more(self, max_time=0, backtime=86400):
+       def more(self, max_time=0):
                """Tries to download more (older posts) posts from Stream.
 
-               TODO backtime isn't used anymore.
-               Diaspora reference: https://github.com/diaspora/diaspora/blob/26a9e50ef935628c800f9a21d345057556fa5c31/app/helpers/stream_helper.rb#L48
-
-               :param backtime: how many seconds substract each time (defaults to one day)
-               :type backtime: int
                :param max_time: seconds since epoch (optional, diaspy'll figure everything on its own)
                :type max_time: int
                """