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

Method parent_comment

scratchattach/site/comment.py:104–124  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 assert_never(self.source)
103
104 def parent_comment(self) -> Comment | None:
105 if self.parent_id is None:
106 return None
107
108 if self.cached_parent_comment is not None:
109 return self.cached_parent_comment
110
111 if self.source == "profile":
112 self.cached_parent_comment = user.User(username=self.source_id, _session=self._session).comment_by_id(
113 self.parent_id)
114
115 elif self.source == "project":
116 p = project.Project(id=self.source_id, _session=self._session)
117 p.update()
118 self.cached_parent_comment = p.comment_by_id(self.parent_id)
119
120 elif self.source == "studio":
121 self.cached_parent_comment = studio.Studio(id=self.source_id, _session=self._session).comment_by_id(
122 self.parent_id)
123
124 return self.cached_parent_comment
125
126 def replies(self, *, use_cache: bool = True, limit=40, offset=0):
127 """

Callers

nothing calls this directly

Calls 3

comment_by_idMethod · 0.95
comment_by_idMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected