mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Factorize the creation of attributes (preparation for #195)
This commit is contained in:
@@ -79,17 +79,12 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
|
||||
|
||||
def _useAttributes(self, attributes):
|
||||
if "label" in attributes: # pragma no branch
|
||||
assert attributes["label"] is None or isinstance(attributes["label"], (str, unicode)), attributes["label"]
|
||||
self._label = github.GithubObject.ValuedAttribute(attributes["label"])
|
||||
self._label = self._makeStringAttribute(attributes["label"])
|
||||
if "ref" in attributes: # pragma no branch
|
||||
assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
|
||||
self._ref = github.GithubObject.ValuedAttribute(attributes["ref"])
|
||||
self._ref = self._makeStringAttribute(attributes["ref"])
|
||||
if "repo" in attributes: # pragma no branch
|
||||
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
|
||||
self._repo = github.GithubObject.ValuedAttribute(None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False))
|
||||
self._repo = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
|
||||
if "sha" in attributes: # pragma no branch
|
||||
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
|
||||
self._sha = github.GithubObject.ValuedAttribute(attributes["sha"])
|
||||
self._sha = self._makeStringAttribute(attributes["sha"])
|
||||
if "user" in attributes: # pragma no branch
|
||||
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
|
||||
self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False))
|
||||
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
|
||||
|
||||
Reference in New Issue
Block a user