MCPcopy
hub / github.com/PyGithub/PyGithub / _useAttributes

Method _useAttributes

github/CheckSuite.py:270–318  ·  view source on GitHub ↗
(self, attributes: dict[str, Any])

Source from the content-addressed store, hash-verified

268 )
269
270 def _useAttributes(self, attributes: dict[str, Any]) -> None:
271 if "after" in attributes: # pragma no branch
272 self._after = self._makeStringAttribute(attributes["after"])
273 if "app" in attributes: # pragma no branch
274 self._app = self._makeClassAttribute(github.GithubApp.GithubApp, attributes["app"])
275 if "before" in attributes: # pragma no branch
276 self._before = self._makeStringAttribute(attributes["before"])
277 if "check_runs_url" in attributes: # pragma no branch
278 self._check_runs_url = self._makeStringAttribute(attributes["check_runs_url"])
279 if "conclusion" in attributes: # pragma no branch
280 self._conclusion = self._makeStringAttribute(attributes["conclusion"])
281 if "created_at" in attributes: # pragma no branch
282 self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
283 if "head_branch" in attributes: # pragma no branch
284 self._head_branch = self._makeStringAttribute(attributes["head_branch"])
285 if "head_commit" in attributes: # pragma no branch
286 # This JSON swaps the 'sha' attribute for an 'id' attribute.
287 # The GitCommit object only looks for 'sha'
288 if "id" in attributes["head_commit"]:
289 attributes["head_commit"]["sha"] = attributes["head_commit"]["id"]
290 self._head_commit = self._makeClassAttribute(github.GitCommit.GitCommit, attributes["head_commit"])
291 if "head_sha" in attributes: # pragma no branch
292 self._head_sha = self._makeStringAttribute(attributes["head_sha"])
293 if "id" in attributes: # pragma no branch
294 self._id = self._makeIntAttribute(attributes["id"])
295 elif "url" in attributes and attributes["url"]:
296 id = attributes["url"].split("/")[-1]
297 if id.isnumeric():
298 self._id = self._makeIntAttribute(int(id))
299 if "latest_check_runs_count" in attributes: # pragma no branch
300 self._latest_check_runs_count = self._makeIntAttribute(attributes["latest_check_runs_count"])
301 if "node_id" in attributes: # pragma no branch
302 self._node_id = self._makeStringAttribute(attributes["node_id"])
303 if "pull_requests" in attributes: # pragma no branch
304 self._pull_requests = self._makeListOfClassesAttribute(
305 github.PullRequest.PullRequest, attributes["pull_requests"]
306 )
307 if "repository" in attributes: # pragma no branch
308 self._repository = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
309 if "rerequestable" in attributes: # pragma no branch
310 self._rerequestable = self._makeBoolAttribute(attributes["rerequestable"])
311 if "runs_rerequestable" in attributes: # pragma no branch
312 self._runs_rerequestable = self._makeBoolAttribute(attributes["runs_rerequestable"])
313 if "status" in attributes: # pragma no branch
314 self._status = self._makeStringAttribute(attributes["status"])
315 if "updated_at" in attributes: # pragma no branch
316 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
317 if "url" in attributes: # pragma no branch
318 self._url = self._makeStringAttribute(attributes["url"])

Callers

nothing calls this directly

Calls 6

_makeStringAttributeMethod · 0.80
_makeClassAttributeMethod · 0.80
_makeIntAttributeMethod · 0.80
_makeBoolAttributeMethod · 0.80

Tested by

no test coverage detected