MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / _useAttributes

Method _useAttributes

github/Gist.py:303–353  ·  view source on GitHub ↗
(self, attributes: dict[str, Any])

Source from the content-addressed store, hash-verified

301 headers, data = self._requester.requestJsonAndCheck("PUT", f"{self.url}/star")
302
303 def _useAttributes(self, attributes: dict[str, Any]) -> None:
304 if "comments" in attributes: # pragma no branch
305 self._comments = self._makeIntAttribute(attributes["comments"])
306 if "comments_enabled" in attributes: # pragma no branch
307 self._comments_enabled = self._makeBoolAttribute(attributes["comments_enabled"])
308 if "comments_url" in attributes: # pragma no branch
309 self._comments_url = self._makeStringAttribute(attributes["comments_url"])
310 if "commits_url" in attributes: # pragma no branch
311 self._commits_url = self._makeStringAttribute(attributes["commits_url"])
312 if "created_at" in attributes: # pragma no branch
313 self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
314 if "description" in attributes: # pragma no branch
315 self._description = self._makeStringAttribute(attributes["description"])
316 if "files" in attributes: # pragma no branch
317 self._files = self._makeDictOfStringsToClassesAttribute(github.GistFile.GistFile, attributes["files"])
318 if "fork_of" in attributes: # pragma no branch
319 self._fork_of = self._makeClassAttribute(Gist, attributes["fork_of"])
320 if "forks" in attributes: # pragma no branch
321 self._forks = self._makeListOfClassesAttribute(Gist, attributes["forks"])
322 if "forks_url" in attributes: # pragma no branch
323 self._forks_url = self._makeStringAttribute(attributes["forks_url"])
324 if "git_pull_url" in attributes: # pragma no branch
325 self._git_pull_url = self._makeStringAttribute(attributes["git_pull_url"])
326 if "git_push_url" in attributes: # pragma no branch
327 self._git_push_url = self._makeStringAttribute(attributes["git_push_url"])
328 if "history" in attributes: # pragma no branch
329 self._history = self._makeListOfClassesAttribute(
330 github.GistHistoryState.GistHistoryState, attributes["history"]
331 )
332 if "html_url" in attributes: # pragma no branch
333 self._html_url = self._makeStringAttribute(attributes["html_url"])
334 if "id" in attributes: # pragma no branch
335 self._id = self._makeStringAttribute(attributes["id"])
336 elif "url" in attributes and attributes["url"]:
337 quoted_id = attributes["url"].split("/")[-1]
338 id = urllib.parse.unquote(quoted_id)
339 self._id = self._makeStringAttribute(id)
340 if "node_id" in attributes: # pragma no branch
341 self._node_id = self._makeStringAttribute(attributes["node_id"])
342 if "owner" in attributes: # pragma no branch
343 self._owner = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
344 if "public" in attributes: # pragma no branch
345 self._public = self._makeBoolAttribute(attributes["public"])
346 if "truncated" in attributes: # pragma no branch
347 self._truncated = self._makeBoolAttribute(attributes["truncated"])
348 if "updated_at" in attributes: # pragma no branch
349 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
350 if "url" in attributes: # pragma no branch
351 self._url = self._makeStringAttribute(attributes["url"])
352 if "user" in attributes: # pragma no branch
353 self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])

Callers 1

editMethod · 0.95

Tested by

no test coverage detected