def _useAttributes( self, attributes ): if "author" in attributes: # pragma no branch assert attributes[ "author" ] is None or isinstance( attributes[ "author" ], dict ), attributes[ "author" ] self._author = None if attributes[ "author" ] is None else NamedUser.NamedUser( self._requester, attributes[ "author" ], completed = False ) if "commit" in attributes: # pragma no branch assert attributes[ "commit" ] is None or isinstance( attributes[ "commit" ], dict ), attributes[ "commit" ] self._commit = None if attributes[ "commit" ] is None else GitCommit.GitCommit( self._requester, attributes[ "commit" ], completed = False ) if "committer" in attributes: # pragma no branch assert attributes[ "committer" ] is None or isinstance( attributes[ "committer" ], dict ), attributes[ "committer" ] self._committer = None if attributes[ "committer" ] is None else NamedUser.NamedUser( self._requester, attributes[ "committer" ], completed = False ) if "files" in attributes: # pragma no branch assert attributes[ "files" ] is None or all( isinstance( element, dict ) for element in attributes[ "files" ] ), attributes[ "files" ] self._files = None if attributes[ "files" ] is None else [ File.File( self._requester, element, completed = False ) for element in attributes[ "files" ] ] if "parents" in attributes: # pragma no branch assert attributes[ "parents" ] is None or all( isinstance( element, dict ) for element in attributes[ "parents" ] ), attributes[ "parents" ] self._parents = None if attributes[ "parents" ] is None else [ Commit( self._requester, element, completed = False ) for element in attributes[ "parents" ] ] if "sha" in attributes: # pragma no branch assert attributes[ "sha" ] is None or isinstance( attributes[ "sha" ], ( str, unicode ) ), attributes[ "sha" ] self._sha = attributes[ "sha" ] if "stats" in attributes: # pragma no branch assert attributes[ "stats" ] is None or isinstance( attributes[ "stats" ], dict ), attributes[ "stats" ] self._stats = None if attributes[ "stats" ] is None else CommitStats.CommitStats( self._requester, attributes[ "stats" ], completed = False ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ]
def _useAttributes(self, attributes): if "assignee" in attributes: # pragma no branch assert attributes["assignee"] is None or isinstance(attributes["assignee"], dict), attributes["assignee"] self._assignee = None if attributes["assignee"] is None else NamedUser.NamedUser(self._requester, attributes["assignee"], completed=False) if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] if "closed_at" in attributes: # pragma no branch assert attributes["closed_at"] is None or isinstance(attributes["closed_at"], (str, unicode)), attributes["closed_at"] self._closed_at = self._parseDatetime(attributes["closed_at"]) if "closed_by" in attributes: # pragma no branch assert attributes["closed_by"] is None or isinstance(attributes["closed_by"], dict), attributes["closed_by"] self._closed_by = None if attributes["closed_by"] is None else NamedUser.NamedUser(self._requester, attributes["closed_by"], completed=False) if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] self._comments = attributes["comments"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] self._id = attributes["id"] if "labels" in attributes: # pragma no branch assert attributes["labels"] is None or all(isinstance(element, dict) for element in attributes["labels"]), attributes["labels"] self._labels = None if attributes["labels"] is None else [ Label.Label(self._requester, element, completed=False) for element in attributes["labels"] ] if "milestone" in attributes: # pragma no branch assert attributes["milestone"] is None or isinstance(attributes["milestone"], dict), attributes["milestone"] self._milestone = None if attributes["milestone"] is None else Milestone.Milestone(self._requester, attributes["milestone"], completed=False) if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] self._number = attributes["number"] if "pull_request" in attributes: # pragma no branch assert attributes["pull_request"] is None or isinstance(attributes["pull_request"], dict), attributes["pull_request"] self._pull_request = None if attributes["pull_request"] is None else IssuePullRequest.IssuePullRequest(self._requester, attributes["pull_request"], completed=False) if "repository" in attributes: # pragma no branch assert attributes["repository"] is None or isinstance(attributes["repository"], dict), attributes["repository"] self._repository = None if attributes["repository"] is None else Repository.Repository(self._requester, attributes["repository"], completed=False) if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] self._state = attributes["state"] if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] self._title = attributes["title"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = self._parseDatetime(attributes["updated_at"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
def _useAttributes(self, attributes): if "actor" in attributes: # pragma no branch assert attributes["actor"] is None or isinstance( attributes["actor"], dict), attributes["actor"] self._actor = None if attributes[ "actor"] is None else NamedUser.NamedUser( self._requester, attributes["actor"], completed=False) if "commit_id" in attributes: # pragma no branch assert attributes["commit_id"] is None or isinstance( attributes["commit_id"], (str, unicode)), attributes["commit_id"] self._commit_id = attributes["commit_id"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "event" in attributes: # pragma no branch assert attributes["event"] is None or isinstance( attributes["event"], (str, unicode)), attributes["event"] self._event = attributes["event"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], int), attributes["id"] self._id = attributes["id"] if "issue" in attributes: # pragma no branch assert attributes["issue"] is None or isinstance( attributes["issue"], dict), attributes["issue"] self._issue = None if attributes["issue"] is None else Issue.Issue( self._requester, attributes["issue"], completed=False) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"]
def _useAttributes(self, attributes): if "change_status" in attributes: # pragma no branch assert attributes["change_status"] is None or isinstance( attributes["change_status"], dict), attributes["change_status"] self._change_status = None if attributes[ "change_status"] is None else CommitStats.CommitStats( self._requester, attributes["change_status"], completed=False) if "committed_at" in attributes: # pragma no branch assert attributes["committed_at"] is None or isinstance( attributes["committed_at"], (str, unicode)), attributes["committed_at"] self._committed_at = None if attributes[ "committed_at"] is None else datetime.datetime.strptime( attributes["committed_at"], "%Y-%m-%dT%H:%M:%SZ") if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance( attributes["user"], dict), attributes["user"] self._user = None if attributes[ "user"] is None else NamedUser.NamedUser( self._requester, attributes["user"], completed=False) if "version" in attributes: # pragma no branch assert attributes["version"] is None or isinstance( attributes["version"], (str, unicode)), attributes["version"] self._version = attributes["version"]
def _useAttributes( self, attributes ): if "body" in attributes: # pragma no branch assert attributes[ "body" ] is None or isinstance( attributes[ "body" ], ( str, unicode ) ), attributes[ "body" ] self._body = attributes[ "body" ] if "commit_id" in attributes: # pragma no branch assert attributes[ "commit_id" ] is None or isinstance( attributes[ "commit_id" ], ( str, unicode ) ), attributes[ "commit_id" ] self._commit_id = attributes[ "commit_id" ] if "created_at" in attributes: # pragma no branch assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ] self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" ) if "id" in attributes: # pragma no branch assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ] self._id = attributes[ "id" ] if "original_commit_id" in attributes: # pragma no branch assert attributes[ "original_commit_id" ] is None or isinstance( attributes[ "original_commit_id" ], ( str, unicode ) ), attributes[ "original_commit_id" ] self._original_commit_id = attributes[ "original_commit_id" ] if "original_position" in attributes: # pragma no branch assert attributes[ "original_position" ] is None or isinstance( attributes[ "original_position" ], int ), attributes[ "original_position" ] self._original_position = attributes[ "original_position" ] if "path" in attributes: # pragma no branch assert attributes[ "path" ] is None or isinstance( attributes[ "path" ], ( str, unicode ) ), attributes[ "path" ] self._path = attributes[ "path" ] if "position" in attributes: # pragma no branch assert attributes[ "position" ] is None or isinstance( attributes[ "position" ], int ), attributes[ "position" ] self._position = attributes[ "position" ] if "updated_at" in attributes: # pragma no branch assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ] self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" ) if "url" in attributes: # pragma no branch assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ] self._url = attributes[ "url" ] if "user" in attributes: # pragma no branch assert attributes[ "user" ] is None or isinstance( attributes[ "user" ], dict ), attributes[ "user" ] self._user = None if attributes[ "user" ] is None else NamedUser.NamedUser( self._requester, attributes[ "user" ], completed = False )
def legacy_search_user_by_email(self, email): assert isinstance(email, (str, unicode)), email headers, data = self.__requester.requestAndCheck( "GET", "/legacy/user/email/" + email, None, None) return NamedUser.NamedUser(self.__requester, Legacy.convertUser(data["user"]), completed=False)
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 = attributes["label"] if "ref" in attributes: # pragma no branch assert attributes["ref"] is None or isinstance( attributes["ref"], (str, unicode)), attributes["ref"] self._ref = attributes["ref"] if "repo" in attributes: # pragma no branch assert attributes["repo"] is None or isinstance( attributes["repo"], dict), attributes["repo"] self._repo = None if attributes[ "repo"] is None else Repository.Repository( self._requester, attributes["repo"], completed=False) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance( attributes["sha"], (str, unicode)), attributes["sha"] self._sha = attributes["sha"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance( attributes["user"], dict), attributes["user"] self._user = None if attributes[ "user"] is None else NamedUser.NamedUser( self._requester, attributes["user"], completed=False)
def _useAttributes(self, attributes): if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "creator" in attributes: # pragma no branch assert attributes["creator"] is None or isinstance( attributes["creator"], dict), attributes["creator"] self._creator = None if attributes[ "creator"] is None else NamedUser.NamedUser( self._requester, attributes["creator"], completed=False) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance( attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], int), attributes["id"] self._id = attributes["id"] if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance( attributes["state"], (str, unicode)), attributes["state"] self._state = attributes["state"] if "target_url" in attributes: # pragma no branch assert attributes["target_url"] is None or isinstance( attributes["target_url"], (str, unicode)), attributes["target_url"] self._target_url = attributes["target_url"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance( attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = self._parseDatetime(attributes["updated_at"])
def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance( attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], (int, long)), attributes["id"] self._id = attributes["id"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance( attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = self._parseDatetime(attributes["updated_at"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance( attributes["user"], dict), attributes["user"] self._user = None if attributes[ "user"] is None else NamedUser.NamedUser( self._requester, attributes["user"], completed=False)
def _useAttributes(self, attributes): if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance(attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] if "commit_id" in attributes: # pragma no branch assert attributes["commit_id"] is None or isinstance(attributes["commit_id"], (str, unicode)), attributes["commit_id"] self._commit_id = attributes["commit_id"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance(attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance(attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], int), attributes["id"] self._id = attributes["id"] if "line" in attributes: # pragma no branch assert attributes["line"] is None or isinstance(attributes["line"], int), attributes["line"] self._line = attributes["line"] if "path" in attributes: # pragma no branch assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] self._path = attributes["path"] if "position" in attributes: # pragma no branch assert attributes["position"] is None or isinstance(attributes["position"], int), attributes["position"] self._position = attributes["position"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance(attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = self._parseDatetime(attributes["updated_at"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"] self._user = None if attributes["user"] is None else NamedUser.NamedUser(self._requester, attributes["user"], completed=False)
def get_user(self, login=None): if login is None: return AuthenticatedUser.AuthenticatedUser( self.__requester, {"url": "https://api.github.com/user"}, completed=False) else: headers, data = self.__requester.requestAndCheck( "GET", "https://api.github.com/users/" + login, None, None) return NamedUser.NamedUser(self.__requester, data, completed=True)
def get_user(self, login=GithubObject.NotSet): assert login is GithubObject.NotSet or isinstance( login, (str, unicode)), login if login is GithubObject.NotSet: return AuthenticatedUser.AuthenticatedUser(self.__requester, {"url": "/user"}, completed=False) else: headers, data = self.__requester.requestAndCheck( "GET", "/users/" + login, None, None) return NamedUser.NamedUser(self.__requester, data, completed=True)
def _useAttributes(self, attributes): if "closed_issues" in attributes: # pragma no branch assert attributes["closed_issues"] is None or isinstance( attributes["closed_issues"], int), attributes["closed_issues"] self._closed_issues = attributes["closed_issues"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = None if attributes[ "created_at"] is None else datetime.datetime.strptime( attributes["created_at"], "%Y-%m-%dT%H:%M:%SZ") if "creator" in attributes: # pragma no branch assert attributes["creator"] is None or isinstance( attributes["creator"], dict), attributes["creator"] self._creator = None if attributes[ "creator"] is None else NamedUser.NamedUser( self._requester, attributes["creator"], completed=False) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance( attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] if "due_on" in attributes: # pragma no branch assert attributes["due_on"] is None or isinstance( attributes["due_on"], (str, unicode)), attributes["due_on"] self._due_on = None if attributes[ "due_on"] is None else datetime.datetime.strptime( attributes["due_on"], "%Y-%m-%dT%H:%M:%SZ") if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], int), attributes["id"] self._id = attributes["id"] if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance( attributes["number"], int), attributes["number"] self._number = attributes["number"] if "open_issues" in attributes: # pragma no branch assert attributes["open_issues"] is None or isinstance( attributes["open_issues"], int), attributes["open_issues"] self._open_issues = attributes["open_issues"] if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance( attributes["state"], (str, unicode)), attributes["state"] self._state = attributes["state"] if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance( attributes["title"], (str, unicode)), attributes["title"] self._title = attributes["title"] if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"]
def _useAttributes(self, attributes): if "actor" in attributes: # pragma no branch assert attributes["actor"] is None or isinstance( attributes["actor"], dict), attributes["actor"] self._actor = None if attributes[ "actor"] is None else NamedUser.NamedUser( self._requester, attributes["actor"], completed=False) if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = None if attributes[ "created_at"] is None else datetime.datetime.strptime( attributes["created_at"], "%Y-%m-%dT%H:%M:%SZ") if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], (str, unicode)), attributes["id"] self._id = attributes["id"] if "org" in attributes: # pragma no branch assert attributes["org"] is None or isinstance( attributes["org"], dict), attributes["org"] self._org = None if attributes[ "org"] is None else Organization.Organization( self._requester, attributes["org"], completed=False) if "payload" in attributes: # pragma no branch assert attributes["payload"] is None or isinstance( attributes["payload"], dict), attributes["payload"] self._payload = attributes["payload"] if "public" in attributes: # pragma no branch assert attributes["public"] is None or isinstance( attributes["public"], bool), attributes["public"] self._public = attributes["public"] if "repo" in attributes: # pragma no branch assert attributes["repo"] is None or isinstance( attributes["repo"], dict), attributes["repo"] self._repo = None if attributes[ "repo"] is None else Repository.Repository( self._requester, attributes["repo"], completed=False) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance( attributes["type"], (str, unicode)), attributes["type"] self._type = attributes["type"]
def _useAttributes(self, attributes): if "clone_url" in attributes: # pragma no branch assert attributes["clone_url"] is None or isinstance( attributes["clone_url"], (str, unicode)), attributes["clone_url"] self._clone_url = attributes["clone_url"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = self._parseDatetime(attributes["created_at"]) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance( attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] if "fork" in attributes: # pragma no branch assert attributes["fork"] is None or isinstance( attributes["fork"], bool), attributes["fork"] self._fork = attributes["fork"] if "forks" in attributes: # pragma no branch assert attributes["forks"] is None or isinstance( attributes["forks"], (int, long)), attributes["forks"] self._forks = attributes["forks"] if "full_name" in attributes: # pragma no branch assert attributes["full_name"] is None or isinstance( attributes["full_name"], (str, unicode)), attributes["full_name"] self._full_name = attributes["full_name"] if "git_url" in attributes: # pragma no branch assert attributes["git_url"] is None or isinstance( attributes["git_url"], (str, unicode)), attributes["git_url"] self._git_url = attributes["git_url"] if "has_downloads" in attributes: # pragma no branch assert attributes["has_downloads"] is None or isinstance( attributes["has_downloads"], bool), attributes["has_downloads"] self._has_downloads = attributes["has_downloads"] if "has_issues" in attributes: # pragma no branch assert attributes["has_issues"] is None or isinstance( attributes["has_issues"], bool), attributes["has_issues"] self._has_issues = attributes["has_issues"] if "has_wiki" in attributes: # pragma no branch assert attributes["has_wiki"] is None or isinstance( attributes["has_wiki"], bool), attributes["has_wiki"] self._has_wiki = attributes["has_wiki"] if "homepage" in attributes: # pragma no branch assert attributes["homepage"] is None or isinstance( attributes["homepage"], (str, unicode)), attributes["homepage"] self._homepage = attributes["homepage"] if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance( attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], (int, long)), attributes["id"] self._id = attributes["id"] if "language" in attributes: # pragma no branch assert attributes["language"] is None or isinstance( attributes["language"], (str, unicode)), attributes["language"] self._language = attributes["language"] if "master_branch" in attributes: # pragma no branch assert attributes["master_branch"] is None or isinstance( attributes["master_branch"], (str, unicode)), attributes["master_branch"] self._master_branch = attributes["master_branch"] if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance( attributes["name"], (str, unicode)), attributes["name"] self._name = attributes["name"] if "open_issues" in attributes: # pragma no branch assert attributes["open_issues"] is None or isinstance( attributes["open_issues"], (int, long)), attributes["open_issues"] self._open_issues = attributes["open_issues"] if "organization" in attributes: # pragma no branch assert attributes["organization"] is None or isinstance( attributes["organization"], dict), attributes["organization"] self._organization = None if attributes[ "organization"] is None else Organization.Organization( self._requester, attributes["organization"], completed=False) if "owner" in attributes: # pragma no branch assert attributes["owner"] is None or isinstance( attributes["owner"], dict), attributes["owner"] self._owner = None if attributes[ "owner"] is None else NamedUser.NamedUser( self._requester, attributes["owner"], completed=False) if "parent" in attributes: # pragma no branch assert attributes["parent"] is None or isinstance( attributes["parent"], dict), attributes["parent"] self._parent = None if attributes["parent"] is None else Repository( self._requester, attributes["parent"], completed=False) if "permissions" in attributes: # pragma no branch assert attributes["permissions"] is None or isinstance( attributes["permissions"], dict), attributes["permissions"] self._permissions = None if attributes[ "permissions"] is None else Permissions.Permissions( self._requester, attributes["permissions"], completed=False) if "private" in attributes: # pragma no branch assert attributes["private"] is None or isinstance( attributes["private"], bool), attributes["private"] self._private = attributes["private"] if "pushed_at" in attributes: # pragma no branch assert attributes["pushed_at"] is None or isinstance( attributes["pushed_at"], (str, unicode)), attributes["pushed_at"] self._pushed_at = self._parseDatetime(attributes["pushed_at"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance( attributes["size"], (int, long)), attributes["size"] self._size = attributes["size"] if "source" in attributes: # pragma no branch assert attributes["source"] is None or isinstance( attributes["source"], dict), attributes["source"] self._source = None if attributes["source"] is None else Repository( self._requester, attributes["source"], completed=False) if "ssh_url" in attributes: # pragma no branch assert attributes["ssh_url"] is None or isinstance( attributes["ssh_url"], (str, unicode)), attributes["ssh_url"] self._ssh_url = attributes["ssh_url"] if "svn_url" in attributes: # pragma no branch assert attributes["svn_url"] is None or isinstance( attributes["svn_url"], (str, unicode)), attributes["svn_url"] self._svn_url = attributes["svn_url"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance( attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = self._parseDatetime(attributes["updated_at"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "watchers" in attributes: # pragma no branch assert attributes["watchers"] is None or isinstance( attributes["watchers"], (int, long)), attributes["watchers"] self._watchers = attributes["watchers"]
def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch assert attributes["additions"] is None or isinstance( attributes["additions"], int), attributes["additions"] self._additions = attributes["additions"] if "base" in attributes: # pragma no branch assert attributes["base"] is None or isinstance( attributes["base"], dict), attributes["base"] self._base = None if attributes[ "base"] is None else PullRequestPart.PullRequestPart( self._requester, attributes["base"], completed=False) if "body" in attributes: # pragma no branch assert attributes["body"] is None or isinstance( attributes["body"], (str, unicode)), attributes["body"] self._body = attributes["body"] if "changed_files" in attributes: # pragma no branch assert attributes["changed_files"] is None or isinstance( attributes["changed_files"], int), attributes["changed_files"] self._changed_files = attributes["changed_files"] if "closed_at" in attributes: # pragma no branch assert attributes["closed_at"] is None or isinstance( attributes["closed_at"], (str, unicode)), attributes["closed_at"] self._closed_at = None if attributes[ "closed_at"] is None else datetime.datetime.strptime( attributes["closed_at"], "%Y-%m-%dT%H:%M:%SZ") if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance( attributes["comments"], int), attributes["comments"] self._comments = attributes["comments"] if "commits" in attributes: # pragma no branch assert attributes["commits"] is None or isinstance( attributes["commits"], int), attributes["commits"] self._commits = attributes["commits"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = None if attributes[ "created_at"] is None else datetime.datetime.strptime( attributes["created_at"], "%Y-%m-%dT%H:%M:%SZ") if "deletions" in attributes: # pragma no branch assert attributes["deletions"] is None or isinstance( attributes["deletions"], int), attributes["deletions"] self._deletions = attributes["deletions"] if "diff_url" in attributes: # pragma no branch assert attributes["diff_url"] is None or isinstance( attributes["diff_url"], (str, unicode)), attributes["diff_url"] self._diff_url = attributes["diff_url"] if "head" in attributes: # pragma no branch assert attributes["head"] is None or isinstance( attributes["head"], dict), attributes["head"] self._head = None if attributes[ "head"] is None else PullRequestPart.PullRequestPart( self._requester, attributes["head"], completed=False) if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance( attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], int), attributes["id"] self._id = attributes["id"] if "issue_url" in attributes: # pragma no branch assert attributes["issue_url"] is None or isinstance( attributes["issue_url"], (str, unicode)), attributes["issue_url"] self._issue_url = attributes["issue_url"] if "mergeable" in attributes: # pragma no branch assert attributes["mergeable"] is None or isinstance( attributes["mergeable"], bool), attributes["mergeable"] self._mergeable = attributes["mergeable"] if "merged" in attributes: # pragma no branch assert attributes["merged"] is None or isinstance( attributes["merged"], bool), attributes["merged"] self._merged = attributes["merged"] if "merged_at" in attributes: # pragma no branch assert attributes["merged_at"] is None or isinstance( attributes["merged_at"], (str, unicode)), attributes["merged_at"] self._merged_at = None if attributes[ "merged_at"] is None else datetime.datetime.strptime( attributes["merged_at"], "%Y-%m-%dT%H:%M:%SZ") if "merged_by" in attributes: # pragma no branch assert attributes["merged_by"] is None or isinstance( attributes["merged_by"], dict), attributes["merged_by"] self._merged_by = None if attributes[ "merged_by"] is None else NamedUser.NamedUser( self._requester, attributes["merged_by"], completed=False) if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance( attributes["number"], int), attributes["number"] self._number = attributes["number"] if "patch_url" in attributes: # pragma no branch assert attributes["patch_url"] is None or isinstance( attributes["patch_url"], (str, unicode)), attributes["patch_url"] self._patch_url = attributes["patch_url"] if "review_comments" in attributes: # pragma no branch assert attributes["review_comments"] is None or isinstance( attributes["review_comments"], int), attributes["review_comments"] self._review_comments = attributes["review_comments"] if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance( attributes["state"], (str, unicode)), attributes["state"] self._state = attributes["state"] if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance( attributes["title"], (str, unicode)), attributes["title"] self._title = attributes["title"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance( attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = None if attributes[ "updated_at"] is None else datetime.datetime.strptime( attributes["updated_at"], "%Y-%m-%dT%H:%M:%SZ") if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance( attributes["user"], dict), attributes["user"] self._user = None if attributes[ "user"] is None else NamedUser.NamedUser( self._requester, attributes["user"], completed=False)
def _useAttributes(self, attributes): if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance( attributes["comments"], int), attributes["comments"] self._comments = attributes["comments"] if "created_at" in attributes: # pragma no branch assert attributes["created_at"] is None or isinstance( attributes["created_at"], (str, unicode)), attributes["created_at"] self._created_at = None if attributes[ "created_at"] is None else datetime.datetime.strptime( attributes["created_at"], "%Y-%m-%dT%H:%M:%SZ") if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance( attributes["description"], (str, unicode)), attributes["description"] self._description = attributes["description"] if "files" in attributes: # pragma no branch assert attributes["files"] is None or all( isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"] self._files = None if attributes["files"] is None else dict( (key, GistFile.GistFile(self._requester, element, completed=False)) for key, element in attributes["files"].iteritems()) if "fork_of" in attributes: # pragma no branch assert attributes["fork_of"] is None or isinstance( attributes["fork_of"], dict), attributes["fork_of"] self._fork_of = None if attributes["fork_of"] is None else Gist( self._requester, attributes["fork_of"], completed=False) if "forks" in attributes: # pragma no branch assert attributes["forks"] is None or all( isinstance(element, dict) for element in attributes["forks"]), attributes["forks"] self._forks = None if attributes["forks"] is None else [ Gist(self._requester, element, completed=False) for element in attributes["forks"] ] if "git_pull_url" in attributes: # pragma no branch assert attributes["git_pull_url"] is None or isinstance( attributes["git_pull_url"], (str, unicode)), attributes["git_pull_url"] self._git_pull_url = attributes["git_pull_url"] if "git_push_url" in attributes: # pragma no branch assert attributes["git_push_url"] is None or isinstance( attributes["git_push_url"], (str, unicode)), attributes["git_push_url"] self._git_push_url = attributes["git_push_url"] if "history" in attributes: # pragma no branch assert attributes["history"] is None or all( isinstance(element, dict) for element in attributes["history"]), attributes["history"] self._history = None if attributes["history"] is None else [ GistHistoryState.GistHistoryState( self._requester, element, completed=False) for element in attributes["history"] ] if "html_url" in attributes: # pragma no branch assert attributes["html_url"] is None or isinstance( attributes["html_url"], (str, unicode)), attributes["html_url"] self._html_url = attributes["html_url"] if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance( attributes["id"], (str, unicode)), attributes["id"] self._id = attributes["id"] if "public" in attributes: # pragma no branch assert attributes["public"] is None or isinstance( attributes["public"], bool), attributes["public"] self._public = attributes["public"] if "updated_at" in attributes: # pragma no branch assert attributes["updated_at"] is None or isinstance( attributes["updated_at"], (str, unicode)), attributes["updated_at"] self._updated_at = None if attributes[ "updated_at"] is None else datetime.datetime.strptime( attributes["updated_at"], "%Y-%m-%dT%H:%M:%SZ") if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance( attributes["url"], (str, unicode)), attributes["url"] self._url = attributes["url"] if "user" in attributes: # pragma no branch assert attributes["user"] is None or isinstance( attributes["user"], dict), attributes["user"] self._user = None if attributes[ "user"] is None else NamedUser.NamedUser( self._requester, attributes["user"], completed=False)