MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / replies

Method replies

scratchattach/site/comment.py:126–145  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

test_commentFunction · 0.80
test_projectFunction · 0.80
test_studioFunction · 0.80

Calls 4

comment_repliesMethod · 0.95
comment_by_idMethod · 0.45
updateMethod · 0.45
comment_repliesMethod · 0.45

Tested by 3

test_commentFunction · 0.64
test_projectFunction · 0.64
test_studioFunction · 0.64