Keyword Arguments: use_cache (bool): Returns the replies cached on the first reply fetch. This makes it SIGNIFICANTLY faster for profile comments. Warning: For profile comments, the replies are retrieved and cached on object creation.
(self, *, use_cache: bool = True, limit=40, offset=0)
| 124 | return self.cached_parent_comment |
| 125 | |
| 126 | def replies(self, *, use_cache: bool = True, limit=40, offset=0): |
| 127 | """ |
| 128 | Keyword Arguments: |
| 129 | use_cache (bool): Returns the replies cached on the first reply fetch. This makes it SIGNIFICANTLY faster for profile comments. Warning: For profile comments, the replies are retrieved and cached on object creation. |
| 130 | """ |
| 131 | if (self.cached_replies is None) or (not use_cache): |
| 132 | if self.source == CommentSource.USER_PROFILE: |
| 133 | self.cached_replies = user.User(username=self.source_id, _session=self._session).comment_by_id( |
| 134 | self.id).cached_replies[offset:offset + limit] |
| 135 | |
| 136 | elif self.source == CommentSource.PROJECT: |
| 137 | p = project.Project(id=self.source_id, _session=self._session) |
| 138 | p.update() |
| 139 | self.cached_replies = p.comment_replies(comment_id=self.id, limit=limit, offset=offset) |
| 140 | |
| 141 | elif self.source == CommentSource.STUDIO: |
| 142 | self.cached_replies = studio.Studio(id=self.source_id, _session=self._session).comment_replies( |
| 143 | comment_id=self.id, limit=limit, offset=offset) |
| 144 | |
| 145 | return self.cached_replies |
| 146 | |
| 147 | # Methods for dealing with the comment |
| 148 |