From 4a5009741acaf8b7864f7b03b55d196b577284c0 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Thu, 12 Sep 2013 00:40:27 +0200 Subject: [PATCH] Use ValuedAttribute and NotSet.value (preparation for #195) --- github/AuthenticatedUser.py | 144 +++++++-------- github/Authorization.py | 36 ++-- github/AuthorizationApplication.py | 8 +- github/Branch.py | 8 +- github/Commit.py | 44 ++--- github/CommitComment.py | 44 ++--- github/CommitStats.py | 12 +- github/CommitStatus.py | 32 ++-- github/Comparison.py | 56 +++--- github/ContentFile.py | 40 ++-- github/Download.py | 80 ++++---- github/Event.py | 32 ++-- github/File.py | 40 ++-- github/Gist.py | 78 ++++---- github/GistComment.py | 24 +-- github/GistFile.py | 24 +-- github/GistHistoryState.py | 86 ++++----- github/GitAuthor.py | 12 +- github/GitBlob.py | 20 +- github/GitCommit.py | 34 ++-- github/GitObject.py | 12 +- github/GitRef.py | 12 +- github/GitTag.py | 24 +-- github/GitTree.py | 14 +- github/GitTreeElement.py | 24 +-- github/GithubObject.py | 18 +- github/GitignoreTemplate.py | 8 +- github/Hook.py | 40 ++-- github/HookDescription.py | 16 +- github/HookResponse.py | 12 +- github/Issue.py | 88 ++++----- github/IssueComment.py | 32 ++-- github/IssueEvent.py | 28 +-- github/IssuePullRequest.py | 12 +- github/Label.py | 12 +- github/Milestone.py | 52 +++--- github/NamedUser.py | 144 +++++++-------- github/Notification.py | 38 ++-- github/NotificationSubject.py | 20 +- github/Organization.py | 116 ++++++------ github/Permissions.py | 12 +- github/Plan.py | 16 +- github/PullRequest.py | 136 +++++++------- github/PullRequestComment.py | 56 +++--- github/PullRequestMergeStatus.py | 12 +- github/PullRequestPart.py | 20 +- github/Rate.py | 12 +- github/RateLimit.py | 4 +- github/Repository.py | 288 ++++++++++++++--------------- github/RepositoryKey.py | 20 +- github/Status.py | 8 +- github/StatusMessage.py | 12 +- github/Tag.py | 16 +- github/Team.py | 36 ++-- github/UserKey.py | 20 +- 55 files changed, 1122 insertions(+), 1122 deletions(-) diff --git a/github/AuthenticatedUser.py b/github/AuthenticatedUser.py index 8ae83202..87c5a193 100644 --- a/github/AuthenticatedUser.py +++ b/github/AuthenticatedUser.py @@ -53,7 +53,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._avatar_url) - return self._NoneIfNotSet(self._avatar_url) + return self._avatar_url.value @property def bio(self): @@ -61,7 +61,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._bio) - return self._NoneIfNotSet(self._bio) + return self._bio.value @property def blog(self): @@ -69,7 +69,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._blog) - return self._NoneIfNotSet(self._blog) + return self._blog.value @property def collaborators(self): @@ -77,7 +77,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._collaborators) - return self._NoneIfNotSet(self._collaborators) + return self._collaborators.value @property def company(self): @@ -85,7 +85,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._company) - return self._NoneIfNotSet(self._company) + return self._company.value @property def created_at(self): @@ -93,7 +93,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def disk_usage(self): @@ -101,7 +101,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._disk_usage) - return self._NoneIfNotSet(self._disk_usage) + return self._disk_usage.value @property def email(self): @@ -109,7 +109,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._email) - return self._NoneIfNotSet(self._email) + return self._email.value @property def events_url(self): @@ -117,7 +117,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._events_url) - return self._NoneIfNotSet(self._events_url) + return self._events_url.value @property def followers(self): @@ -125,7 +125,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._followers) - return self._NoneIfNotSet(self._followers) + return self._followers.value @property def followers_url(self): @@ -133,7 +133,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._followers_url) - return self._NoneIfNotSet(self._followers_url) + return self._followers_url.value @property def following(self): @@ -141,7 +141,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._following) - return self._NoneIfNotSet(self._following) + return self._following.value @property def following_url(self): @@ -149,7 +149,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._following_url) - return self._NoneIfNotSet(self._following_url) + return self._following_url.value @property def gists_url(self): @@ -157,7 +157,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._gists_url) - return self._NoneIfNotSet(self._gists_url) + return self._gists_url.value @property def gravatar_id(self): @@ -165,7 +165,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._gravatar_id) - return self._NoneIfNotSet(self._gravatar_id) + return self._gravatar_id.value @property def hireable(self): @@ -173,7 +173,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._hireable) - return self._NoneIfNotSet(self._hireable) + return self._hireable.value @property def html_url(self): @@ -181,7 +181,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -189,7 +189,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def location(self): @@ -197,7 +197,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._location) - return self._NoneIfNotSet(self._location) + return self._location.value @property def login(self): @@ -205,7 +205,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._login) - return self._NoneIfNotSet(self._login) + return self._login.value @property def name(self): @@ -213,7 +213,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def organizations_url(self): @@ -221,7 +221,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._organizations_url) - return self._NoneIfNotSet(self._organizations_url) + return self._organizations_url.value @property def owned_private_repos(self): @@ -229,7 +229,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._owned_private_repos) - return self._NoneIfNotSet(self._owned_private_repos) + return self._owned_private_repos.value @property def plan(self): @@ -237,7 +237,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: :class:`github.Plan.Plan` """ self._completeIfNotSet(self._plan) - return self._NoneIfNotSet(self._plan) + return self._plan.value @property def private_gists(self): @@ -245,7 +245,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._private_gists) - return self._NoneIfNotSet(self._private_gists) + return self._private_gists.value @property def public_gists(self): @@ -253,7 +253,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_gists) - return self._NoneIfNotSet(self._public_gists) + return self._public_gists.value @property def public_repos(self): @@ -261,7 +261,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_repos) - return self._NoneIfNotSet(self._public_repos) + return self._public_repos.value @property def received_events_url(self): @@ -269,7 +269,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._received_events_url) - return self._NoneIfNotSet(self._received_events_url) + return self._received_events_url.value @property def repos_url(self): @@ -277,7 +277,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._repos_url) - return self._NoneIfNotSet(self._repos_url) + return self._repos_url.value @property def site_admin(self): @@ -285,7 +285,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._site_admin) - return self._NoneIfNotSet(self._site_admin) + return self._site_admin.value @property def starred_url(self): @@ -293,7 +293,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._starred_url) - return self._NoneIfNotSet(self._starred_url) + return self._starred_url.value @property def subscriptions_url(self): @@ -301,7 +301,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._subscriptions_url) - return self._NoneIfNotSet(self._subscriptions_url) + return self._subscriptions_url.value @property def total_private_repos(self): @@ -309,7 +309,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._total_private_repos) - return self._NoneIfNotSet(self._total_private_repos) + return self._total_private_repos.value @property def type(self): @@ -317,7 +317,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._type) - return self._NoneIfNotSet(self._type) + return self._type.value @property def updated_at(self): @@ -325,7 +325,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -333,7 +333,7 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def add_to_emails(self, *emails): """ @@ -1067,109 +1067,109 @@ class AuthenticatedUser(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] - self._avatar_url = attributes["avatar_url"] + self._avatar_url = github.GithubObject.ValuedAttribute(attributes["avatar_url"]) if "bio" in attributes: # pragma no branch assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"] - self._bio = attributes["bio"] + self._bio = github.GithubObject.ValuedAttribute(attributes["bio"]) if "blog" in attributes: # pragma no branch assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] - self._blog = attributes["blog"] + self._blog = github.GithubObject.ValuedAttribute(attributes["blog"]) if "collaborators" in attributes: # pragma no branch assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] - self._collaborators = attributes["collaborators"] + self._collaborators = github.GithubObject.ValuedAttribute(attributes["collaborators"]) if "company" in attributes: # pragma no branch assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] - self._company = attributes["company"] + self._company = github.GithubObject.ValuedAttribute(attributes["company"]) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "disk_usage" in attributes: # pragma no branch assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] - self._disk_usage = attributes["disk_usage"] + self._disk_usage = github.GithubObject.ValuedAttribute(attributes["disk_usage"]) if "email" in attributes: # pragma no branch assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] - self._email = attributes["email"] + self._email = github.GithubObject.ValuedAttribute(attributes["email"]) if "events_url" in attributes: # pragma no branch assert attributes["events_url"] is None or isinstance(attributes["events_url"], (str, unicode)), attributes["events_url"] - self._events_url = attributes["events_url"] + self._events_url = github.GithubObject.ValuedAttribute(attributes["events_url"]) if "followers" in attributes: # pragma no branch assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] - self._followers = attributes["followers"] + self._followers = github.GithubObject.ValuedAttribute(attributes["followers"]) if "followers_url" in attributes: # pragma no branch assert attributes["followers_url"] is None or isinstance(attributes["followers_url"], (str, unicode)), attributes["followers_url"] - self._followers_url = attributes["followers_url"] + self._followers_url = github.GithubObject.ValuedAttribute(attributes["followers_url"]) if "following" in attributes: # pragma no branch assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] - self._following = attributes["following"] + self._following = github.GithubObject.ValuedAttribute(attributes["following"]) if "following_url" in attributes: # pragma no branch assert attributes["following_url"] is None or isinstance(attributes["following_url"], (str, unicode)), attributes["following_url"] - self._following_url = attributes["following_url"] + self._following_url = github.GithubObject.ValuedAttribute(attributes["following_url"]) if "gists_url" in attributes: # pragma no branch assert attributes["gists_url"] is None or isinstance(attributes["gists_url"], (str, unicode)), attributes["gists_url"] - self._gists_url = attributes["gists_url"] + self._gists_url = github.GithubObject.ValuedAttribute(attributes["gists_url"]) if "gravatar_id" in attributes: # pragma no branch assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] - self._gravatar_id = attributes["gravatar_id"] + self._gravatar_id = github.GithubObject.ValuedAttribute(attributes["gravatar_id"]) if "hireable" in attributes: # pragma no branch assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"] - self._hireable = attributes["hireable"] + self._hireable = github.GithubObject.ValuedAttribute(attributes["hireable"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "location" in attributes: # pragma no branch assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] - self._location = attributes["location"] + self._location = github.GithubObject.ValuedAttribute(attributes["location"]) if "login" in attributes: # pragma no branch assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] - self._login = attributes["login"] + self._login = github.GithubObject.ValuedAttribute(attributes["login"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "organizations_url" in attributes: # pragma no branch assert attributes["organizations_url"] is None or isinstance(attributes["organizations_url"], (str, unicode)), attributes["organizations_url"] - self._organizations_url = attributes["organizations_url"] + self._organizations_url = github.GithubObject.ValuedAttribute(attributes["organizations_url"]) if "owned_private_repos" in attributes: # pragma no branch assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] - self._owned_private_repos = attributes["owned_private_repos"] + self._owned_private_repos = github.GithubObject.ValuedAttribute(attributes["owned_private_repos"]) if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False) + self._plan = github.GithubObject.ValuedAttribute(None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] - self._private_gists = attributes["private_gists"] + self._private_gists = github.GithubObject.ValuedAttribute(attributes["private_gists"]) if "public_gists" in attributes: # pragma no branch assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] - self._public_gists = attributes["public_gists"] + self._public_gists = github.GithubObject.ValuedAttribute(attributes["public_gists"]) if "public_repos" in attributes: # pragma no branch assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] - self._public_repos = attributes["public_repos"] + self._public_repos = github.GithubObject.ValuedAttribute(attributes["public_repos"]) if "received_events_url" in attributes: # pragma no branch assert attributes["received_events_url"] is None or isinstance(attributes["received_events_url"], (str, unicode)), attributes["received_events_url"] - self._received_events_url = attributes["received_events_url"] + self._received_events_url = github.GithubObject.ValuedAttribute(attributes["received_events_url"]) if "repos_url" in attributes: # pragma no branch assert attributes["repos_url"] is None or isinstance(attributes["repos_url"], (str, unicode)), attributes["repos_url"] - self._repos_url = attributes["repos_url"] + self._repos_url = github.GithubObject.ValuedAttribute(attributes["repos_url"]) if "site_admin" in attributes: # pragma no branch assert attributes["site_admin"] is None or isinstance(attributes["site_admin"], bool), attributes["site_admin"] - self._site_admin = attributes["site_admin"] + self._site_admin = github.GithubObject.ValuedAttribute(attributes["site_admin"]) if "starred_url" in attributes: # pragma no branch assert attributes["starred_url"] is None or isinstance(attributes["starred_url"], (str, unicode)), attributes["starred_url"] - self._starred_url = attributes["starred_url"] + self._starred_url = github.GithubObject.ValuedAttribute(attributes["starred_url"]) if "subscriptions_url" in attributes: # pragma no branch assert attributes["subscriptions_url"] is None or isinstance(attributes["subscriptions_url"], (str, unicode)), attributes["subscriptions_url"] - self._subscriptions_url = attributes["subscriptions_url"] + self._subscriptions_url = github.GithubObject.ValuedAttribute(attributes["subscriptions_url"]) if "total_private_repos" in attributes: # pragma no branch assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] - self._total_private_repos = attributes["total_private_repos"] + self._total_private_repos = github.GithubObject.ValuedAttribute(attributes["total_private_repos"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) 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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Authorization.py b/github/Authorization.py index a004fedf..4f8d6b3e 100644 --- a/github/Authorization.py +++ b/github/Authorization.py @@ -40,7 +40,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: :class:`github.AuthorizationApplication.AuthorizationApplication` """ self._completeIfNotSet(self._app) - return self._NoneIfNotSet(self._app) + return self._app.value @property def created_at(self): @@ -48,7 +48,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def id(self): @@ -56,7 +56,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def note(self): @@ -64,7 +64,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._note) - return self._NoneIfNotSet(self._note) + return self._note.value @property def note_url(self): @@ -72,7 +72,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._note_url) - return self._NoneIfNotSet(self._note_url) + return self._note_url.value @property def scopes(self): @@ -80,7 +80,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: list of string """ self._completeIfNotSet(self._scopes) - return self._NoneIfNotSet(self._scopes) + return self._scopes.value @property def token(self): @@ -88,7 +88,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._token) - return self._NoneIfNotSet(self._token) + return self._token.value @property def updated_at(self): @@ -96,7 +96,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -104,7 +104,7 @@ class Authorization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -163,28 +163,28 @@ class Authorization(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "app" in attributes: # pragma no branch assert attributes["app"] is None or isinstance(attributes["app"], dict), attributes["app"] - self._app = None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, self._headers, attributes["app"], completed=False) + self._app = github.GithubObject.ValuedAttribute(None if attributes["app"] is None else github.AuthorizationApplication.AuthorizationApplication(self._requester, self._headers, attributes["app"], 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 = self._parseDatetime(attributes["created_at"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "note" in attributes: # pragma no branch assert attributes["note"] is None or isinstance(attributes["note"], (str, unicode)), attributes["note"] - self._note = attributes["note"] + self._note = github.GithubObject.ValuedAttribute(attributes["note"]) if "note_url" in attributes: # pragma no branch assert attributes["note_url"] is None or isinstance(attributes["note_url"], (str, unicode)), attributes["note_url"] - self._note_url = attributes["note_url"] + self._note_url = github.GithubObject.ValuedAttribute(attributes["note_url"]) if "scopes" in attributes: # pragma no branch assert attributes["scopes"] is None or all(isinstance(element, (str, unicode)) for element in attributes["scopes"]), attributes["scopes"] - self._scopes = attributes["scopes"] + self._scopes = github.GithubObject.ValuedAttribute(attributes["scopes"]) if "token" in attributes: # pragma no branch assert attributes["token"] is None or isinstance(attributes["token"], (str, unicode)), attributes["token"] - self._token = attributes["token"] + self._token = github.GithubObject.ValuedAttribute(attributes["token"]) 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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/AuthorizationApplication.py b/github/AuthorizationApplication.py index 8f38bc14..04830b45 100644 --- a/github/AuthorizationApplication.py +++ b/github/AuthorizationApplication.py @@ -38,7 +38,7 @@ class AuthorizationApplication(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def url(self): @@ -46,7 +46,7 @@ class AuthorizationApplication(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._name = github.GithubObject.NotSet @@ -55,7 +55,7 @@ class AuthorizationApplication(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Branch.py b/github/Branch.py index 9e761826..3d5d0316 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -40,14 +40,14 @@ class Branch(github.GithubObject.NonCompletableGithubObject): """ :type: :class:`github.Commit.Commit` """ - return self._NoneIfNotSet(self._commit) + return self._commit.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value def _initAttributes(self): self._commit = github.GithubObject.NotSet @@ -56,7 +56,7 @@ class Branch(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): 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 github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False) + self._commit = github.GithubObject.ValuedAttribute(None if attributes["commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False)) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) diff --git a/github/Commit.py b/github/Commit.py index eb5fa9ce..8b16a1d0 100644 --- a/github/Commit.py +++ b/github/Commit.py @@ -47,7 +47,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._author) - return self._NoneIfNotSet(self._author) + return self._author.value @property def comments_url(self): @@ -55,7 +55,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def commit(self): @@ -63,7 +63,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitCommit.GitCommit` """ self._completeIfNotSet(self._commit) - return self._NoneIfNotSet(self._commit) + return self._commit.value @property def committer(self): @@ -71,7 +71,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._committer) - return self._NoneIfNotSet(self._committer) + return self._committer.value @property def files(self): @@ -79,7 +79,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.File.File` """ self._completeIfNotSet(self._files) - return self._NoneIfNotSet(self._files) + return self._files.value @property def html_url(self): @@ -87,7 +87,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def parents(self): @@ -95,7 +95,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.Commit.Commit` """ self._completeIfNotSet(self._parents) - return self._NoneIfNotSet(self._parents) + return self._parents.value @property def sha(self): @@ -103,7 +103,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def stats(self): @@ -111,7 +111,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: :class:`github.CommitStats.CommitStats` """ self._completeIfNotSet(self._stats) - return self._NoneIfNotSet(self._stats) + return self._stats.value @property def url(self): @@ -119,7 +119,7 @@ class Commit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def create_comment(self, body, line=github.GithubObject.NotSet, path=github.GithubObject.NotSet, position=github.GithubObject.NotSet): """ @@ -218,37 +218,37 @@ class Commit(github.GithubObject.CompletableGithubObject): 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["author"], completed=False) + self._author = github.GithubObject.ValuedAttribute(None if attributes["author"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["author"], completed=False)) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_url"]) 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 github.GitCommit.GitCommit(self._requester, self._headers, attributes["commit"], completed=False) + self._commit = github.GithubObject.ValuedAttribute(None if attributes["commit"] is None else github.GitCommit.GitCommit(self._requester, self._headers, 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["committer"], completed=False) + self._committer = github.GithubObject.ValuedAttribute(None if attributes["committer"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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 [ + self._files = github.GithubObject.ValuedAttribute(None if attributes["files"] is None else [ github.File.File(self._requester, self._headers, element, completed=False) for element in attributes["files"] - ] + ]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_url"]) 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 [ + self._parents = github.GithubObject.ValuedAttribute(None if attributes["parents"] is None else [ Commit(self._requester, self._headers, 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"] + self._sha = github.GithubObject.ValuedAttribute(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 github.CommitStats.CommitStats(self._requester, self._headers, attributes["stats"], completed=False) + self._stats = github.GithubObject.ValuedAttribute(None if attributes["stats"] is None else github.CommitStats.CommitStats(self._requester, self._headers, 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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/CommitComment.py b/github/CommitComment.py index c2c897d1..3f412115 100644 --- a/github/CommitComment.py +++ b/github/CommitComment.py @@ -40,7 +40,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def commit_id(self): @@ -48,7 +48,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commit_id) - return self._NoneIfNotSet(self._commit_id) + return self._commit_id.value @property def created_at(self): @@ -56,7 +56,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def html_url(self): @@ -64,7 +64,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -72,7 +72,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def line(self): @@ -80,7 +80,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._line) - return self._NoneIfNotSet(self._line) + return self._line.value @property def path(self): @@ -88,7 +88,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._path) - return self._NoneIfNotSet(self._path) + return self._path.value @property def position(self): @@ -96,7 +96,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._position) - return self._NoneIfNotSet(self._position) + return self._position.value @property def updated_at(self): @@ -104,7 +104,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -112,7 +112,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -120,7 +120,7 @@ class CommitComment(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def delete(self): """ @@ -165,34 +165,34 @@ class CommitComment(github.GithubObject.CompletableGithubObject): 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"] + self._body = github.GithubObject.ValuedAttribute(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"] + self._commit_id = github.GithubObject.ValuedAttribute(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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "line" in attributes: # pragma no branch assert attributes["line"] is None or isinstance(attributes["line"], (int, long)), attributes["line"] - self._line = attributes["line"] + self._line = github.GithubObject.ValuedAttribute(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"] + self._path = github.GithubObject.ValuedAttribute(attributes["path"]) if "position" in attributes: # pragma no branch assert attributes["position"] is None or isinstance(attributes["position"], (int, long)), attributes["position"] - self._position = attributes["position"] + self._position = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/CommitStats.py b/github/CommitStats.py index 49f40778..ac1ab8fd 100644 --- a/github/CommitStats.py +++ b/github/CommitStats.py @@ -37,21 +37,21 @@ class CommitStats(github.GithubObject.NonCompletableGithubObject): """ :type: integer """ - return self._NoneIfNotSet(self._additions) + return self._additions.value @property def deletions(self): """ :type: integer """ - return self._NoneIfNotSet(self._deletions) + return self._deletions.value @property def total(self): """ :type: integer """ - return self._NoneIfNotSet(self._total) + return self._total.value def _initAttributes(self): self._additions = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class CommitStats(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] - self._additions = attributes["additions"] + self._additions = github.GithubObject.ValuedAttribute(attributes["additions"]) if "deletions" in attributes: # pragma no branch assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] - self._deletions = attributes["deletions"] + self._deletions = github.GithubObject.ValuedAttribute(attributes["deletions"]) if "total" in attributes: # pragma no branch assert attributes["total"] is None or isinstance(attributes["total"], (int, long)), attributes["total"] - self._total = attributes["total"] + self._total = github.GithubObject.ValuedAttribute(attributes["total"]) diff --git a/github/CommitStatus.py b/github/CommitStatus.py index 6ac935a8..af06386f 100644 --- a/github/CommitStatus.py +++ b/github/CommitStatus.py @@ -39,56 +39,56 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def creator(self): """ :type: :class:`github.NamedUser.NamedUser` """ - return self._NoneIfNotSet(self._creator) + return self._creator.value @property def description(self): """ :type: string """ - return self._NoneIfNotSet(self._description) + return self._description.value @property def id(self): """ :type: integer """ - return self._NoneIfNotSet(self._id) + return self._id.value @property def state(self): """ :type: string """ - return self._NoneIfNotSet(self._state) + return self._state.value @property def target_url(self): """ :type: string """ - return self._NoneIfNotSet(self._target_url) + return self._target_url.value @property def updated_at(self): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): """ :type: string """ - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._created_at = github.GithubObject.NotSet @@ -103,25 +103,25 @@ class CommitStatus(github.GithubObject.NonCompletableGithubObject): 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"]) + self._created_at = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["creator"], completed=False) + self._creator = github.GithubObject.ValuedAttribute(None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._description = github.GithubObject.ValuedAttribute(attributes["description"]) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._state = github.GithubObject.ValuedAttribute(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"] + self._target_url = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Comparison.py b/github/Comparison.py index f75a62d0..abbcc312 100644 --- a/github/Comparison.py +++ b/github/Comparison.py @@ -41,7 +41,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._ahead_by) - return self._NoneIfNotSet(self._ahead_by) + return self._ahead_by.value @property def base_commit(self): @@ -49,7 +49,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: :class:`github.Commit.Commit` """ self._completeIfNotSet(self._base_commit) - return self._NoneIfNotSet(self._base_commit) + return self._base_commit.value @property def behind_by(self): @@ -57,7 +57,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._behind_by) - return self._NoneIfNotSet(self._behind_by) + return self._behind_by.value @property def commits(self): @@ -65,7 +65,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.Commit.Commit` """ self._completeIfNotSet(self._commits) - return self._NoneIfNotSet(self._commits) + return self._commits.value @property def diff_url(self): @@ -73,7 +73,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._diff_url) - return self._NoneIfNotSet(self._diff_url) + return self._diff_url.value @property def files(self): @@ -81,7 +81,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.File.File` """ self._completeIfNotSet(self._files) - return self._NoneIfNotSet(self._files) + return self._files.value @property def html_url(self): @@ -89,7 +89,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def merge_base_commit(self): @@ -97,7 +97,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: :class:`github.Commit.Commit` """ self._completeIfNotSet(self._merge_base_commit) - return self._NoneIfNotSet(self._merge_base_commit) + return self._merge_base_commit.value @property def patch_url(self): @@ -105,7 +105,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._patch_url) - return self._NoneIfNotSet(self._patch_url) + return self._patch_url.value @property def permalink_url(self): @@ -113,7 +113,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._permalink_url) - return self._NoneIfNotSet(self._permalink_url) + return self._permalink_url.value @property def status(self): @@ -121,7 +121,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._status) - return self._NoneIfNotSet(self._status) + return self._status.value @property def total_commits(self): @@ -129,7 +129,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._total_commits) - return self._NoneIfNotSet(self._total_commits) + return self._total_commits.value @property def url(self): @@ -137,7 +137,7 @@ class Comparison(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._ahead_by = github.GithubObject.NotSet @@ -157,46 +157,46 @@ class Comparison(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "ahead_by" in attributes: # pragma no branch assert attributes["ahead_by"] is None or isinstance(attributes["ahead_by"], (int, long)), attributes["ahead_by"] - self._ahead_by = attributes["ahead_by"] + self._ahead_by = github.GithubObject.ValuedAttribute(attributes["ahead_by"]) if "base_commit" in attributes: # pragma no branch assert attributes["base_commit"] is None or isinstance(attributes["base_commit"], dict), attributes["base_commit"] - self._base_commit = None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["base_commit"], completed=False) + self._base_commit = github.GithubObject.ValuedAttribute(None if attributes["base_commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["base_commit"], completed=False)) if "behind_by" in attributes: # pragma no branch assert attributes["behind_by"] is None or isinstance(attributes["behind_by"], (int, long)), attributes["behind_by"] - self._behind_by = attributes["behind_by"] + self._behind_by = github.GithubObject.ValuedAttribute(attributes["behind_by"]) if "commits" in attributes: # pragma no branch assert attributes["commits"] is None or all(isinstance(element, dict) for element in attributes["commits"]), attributes["commits"] - self._commits = None if attributes["commits"] is None else [ + self._commits = github.GithubObject.ValuedAttribute(None if attributes["commits"] is None else [ github.Commit.Commit(self._requester, self._headers, element, completed=False) for element in attributes["commits"] - ] + ]) 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"] + self._diff_url = github.GithubObject.ValuedAttribute(attributes["diff_url"]) 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 [ + self._files = github.GithubObject.ValuedAttribute(None if attributes["files"] is None else [ github.File.File(self._requester, self._headers, element, completed=False) for element in attributes["files"] - ] + ]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_url"]) if "merge_base_commit" in attributes: # pragma no branch assert attributes["merge_base_commit"] is None or isinstance(attributes["merge_base_commit"], dict), attributes["merge_base_commit"] - self._merge_base_commit = None if attributes["merge_base_commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["merge_base_commit"], completed=False) + self._merge_base_commit = github.GithubObject.ValuedAttribute(None if attributes["merge_base_commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["merge_base_commit"], completed=False)) 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"] + self._patch_url = github.GithubObject.ValuedAttribute(attributes["patch_url"]) if "permalink_url" in attributes: # pragma no branch assert attributes["permalink_url"] is None or isinstance(attributes["permalink_url"], (str, unicode)), attributes["permalink_url"] - self._permalink_url = attributes["permalink_url"] + self._permalink_url = github.GithubObject.ValuedAttribute(attributes["permalink_url"]) if "status" in attributes: # pragma no branch assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] - self._status = attributes["status"] + self._status = github.GithubObject.ValuedAttribute(attributes["status"]) if "total_commits" in attributes: # pragma no branch assert attributes["total_commits"] is None or isinstance(attributes["total_commits"], (int, long)), attributes["total_commits"] - self._total_commits = attributes["total_commits"] + self._total_commits = github.GithubObject.ValuedAttribute(attributes["total_commits"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/ContentFile.py b/github/ContentFile.py index d13154dc..e9ac272f 100644 --- a/github/ContentFile.py +++ b/github/ContentFile.py @@ -38,7 +38,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._content) - return self._NoneIfNotSet(self._content) + return self._content.value @property def encoding(self): @@ -46,7 +46,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._encoding) - return self._NoneIfNotSet(self._encoding) + return self._encoding.value @property def git_url(self): @@ -54,7 +54,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_url) - return self._NoneIfNotSet(self._git_url) + return self._git_url.value @property def html_url(self): @@ -62,7 +62,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def name(self): @@ -70,7 +70,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def path(self): @@ -78,7 +78,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._path) - return self._NoneIfNotSet(self._path) + return self._path.value @property def sha(self): @@ -86,7 +86,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def size(self): @@ -94,7 +94,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._size) - return self._NoneIfNotSet(self._size) + return self._size.value @property def type(self): @@ -102,7 +102,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._type) - return self._NoneIfNotSet(self._type) + return self._type.value @property def url(self): @@ -110,7 +110,7 @@ class ContentFile(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._content = github.GithubObject.NotSet @@ -126,31 +126,31 @@ class ContentFile(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] - self._content = attributes["content"] + self._content = github.GithubObject.ValuedAttribute(attributes["content"]) if "encoding" in attributes: # pragma no branch assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"] - self._encoding = attributes["encoding"] + self._encoding = github.GithubObject.ValuedAttribute(attributes["encoding"]) 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"] + self._git_url = github.GithubObject.ValuedAttribute(attributes["git_url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_url"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "path" in attributes: # pragma no branch assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] - self._path = attributes["path"] + self._path = github.GithubObject.ValuedAttribute(attributes["path"]) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] - self._size = attributes["size"] + self._size = github.GithubObject.ValuedAttribute(attributes["size"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Download.py b/github/Download.py index 2cd057ca..e5347999 100644 --- a/github/Download.py +++ b/github/Download.py @@ -38,7 +38,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._accesskeyid) - return self._NoneIfNotSet(self._accesskeyid) + return self._accesskeyid.value @property def acl(self): @@ -46,7 +46,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._acl) - return self._NoneIfNotSet(self._acl) + return self._acl.value @property def bucket(self): @@ -54,7 +54,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._bucket) - return self._NoneIfNotSet(self._bucket) + return self._bucket.value @property def content_type(self): @@ -62,7 +62,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._content_type) - return self._NoneIfNotSet(self._content_type) + return self._content_type.value @property def created_at(self): @@ -70,7 +70,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def description(self): @@ -78,7 +78,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._description) - return self._NoneIfNotSet(self._description) + return self._description.value @property def download_count(self): @@ -86,7 +86,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._download_count) - return self._NoneIfNotSet(self._download_count) + return self._download_count.value @property def expirationdate(self): @@ -94,7 +94,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._expirationdate) - return self._NoneIfNotSet(self._expirationdate) + return self._expirationdate.value @property def html_url(self): @@ -102,7 +102,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -110,7 +110,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def mime_type(self): @@ -118,7 +118,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._mime_type) - return self._NoneIfNotSet(self._mime_type) + return self._mime_type.value @property def name(self): @@ -126,7 +126,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def path(self): @@ -134,7 +134,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._path) - return self._NoneIfNotSet(self._path) + return self._path.value @property def policy(self): @@ -142,7 +142,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._policy) - return self._NoneIfNotSet(self._policy) + return self._policy.value @property def prefix(self): @@ -150,7 +150,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._prefix) - return self._NoneIfNotSet(self._prefix) + return self._prefix.value @property def redirect(self): @@ -158,7 +158,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._redirect) - return self._NoneIfNotSet(self._redirect) + return self._redirect.value @property def s3_url(self): @@ -166,7 +166,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._s3_url) - return self._NoneIfNotSet(self._s3_url) + return self._s3_url.value @property def signature(self): @@ -174,7 +174,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._signature) - return self._NoneIfNotSet(self._signature) + return self._signature.value @property def size(self): @@ -182,7 +182,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._size) - return self._NoneIfNotSet(self._size) + return self._size.value @property def url(self): @@ -190,7 +190,7 @@ class Download(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -227,61 +227,61 @@ class Download(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "accesskeyid" in attributes: # pragma no branch assert attributes["accesskeyid"] is None or isinstance(attributes["accesskeyid"], (str, unicode)), attributes["accesskeyid"] - self._accesskeyid = attributes["accesskeyid"] + self._accesskeyid = github.GithubObject.ValuedAttribute(attributes["accesskeyid"]) if "acl" in attributes: # pragma no branch assert attributes["acl"] is None or isinstance(attributes["acl"], (str, unicode)), attributes["acl"] - self._acl = attributes["acl"] + self._acl = github.GithubObject.ValuedAttribute(attributes["acl"]) if "bucket" in attributes: # pragma no branch assert attributes["bucket"] is None or isinstance(attributes["bucket"], (str, unicode)), attributes["bucket"] - self._bucket = attributes["bucket"] + self._bucket = github.GithubObject.ValuedAttribute(attributes["bucket"]) if "content_type" in attributes: # pragma no branch assert attributes["content_type"] is None or isinstance(attributes["content_type"], (str, unicode)), attributes["content_type"] - self._content_type = attributes["content_type"] + self._content_type = github.GithubObject.ValuedAttribute(attributes["content_type"]) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._description = github.GithubObject.ValuedAttribute(attributes["description"]) if "download_count" in attributes: # pragma no branch assert attributes["download_count"] is None or isinstance(attributes["download_count"], (int, long)), attributes["download_count"] - self._download_count = attributes["download_count"] + self._download_count = github.GithubObject.ValuedAttribute(attributes["download_count"]) if "expirationdate" in attributes: # pragma no branch assert attributes["expirationdate"] is None or isinstance(attributes["expirationdate"], (str, unicode)), attributes["expirationdate"] - self._expirationdate = self._parseDatetime(attributes["expirationdate"]) + self._expirationdate = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["expirationdate"])) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "mime_type" in attributes: # pragma no branch assert attributes["mime_type"] is None or isinstance(attributes["mime_type"], (str, unicode)), attributes["mime_type"] - self._mime_type = attributes["mime_type"] + self._mime_type = github.GithubObject.ValuedAttribute(attributes["mime_type"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "path" in attributes: # pragma no branch assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] - self._path = attributes["path"] + self._path = github.GithubObject.ValuedAttribute(attributes["path"]) if "policy" in attributes: # pragma no branch assert attributes["policy"] is None or isinstance(attributes["policy"], (str, unicode)), attributes["policy"] - self._policy = attributes["policy"] + self._policy = github.GithubObject.ValuedAttribute(attributes["policy"]) if "prefix" in attributes: # pragma no branch assert attributes["prefix"] is None or isinstance(attributes["prefix"], (str, unicode)), attributes["prefix"] - self._prefix = attributes["prefix"] + self._prefix = github.GithubObject.ValuedAttribute(attributes["prefix"]) if "redirect" in attributes: # pragma no branch assert attributes["redirect"] is None or isinstance(attributes["redirect"], bool), attributes["redirect"] - self._redirect = attributes["redirect"] + self._redirect = github.GithubObject.ValuedAttribute(attributes["redirect"]) if "s3_url" in attributes: # pragma no branch assert attributes["s3_url"] is None or isinstance(attributes["s3_url"], (str, unicode)), attributes["s3_url"] - self._s3_url = attributes["s3_url"] + self._s3_url = github.GithubObject.ValuedAttribute(attributes["s3_url"]) if "signature" in attributes: # pragma no branch assert attributes["signature"] is None or isinstance(attributes["signature"], (str, unicode)), attributes["signature"] - self._signature = attributes["signature"] + self._signature = github.GithubObject.ValuedAttribute(attributes["signature"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] - self._size = attributes["size"] + self._size = github.GithubObject.ValuedAttribute(attributes["size"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Event.py b/github/Event.py index 20351025..5c6edea7 100644 --- a/github/Event.py +++ b/github/Event.py @@ -42,56 +42,56 @@ class Event(github.GithubObject.NonCompletableGithubObject): """ :type: :class:`github.NamedUser.NamedUser` """ - return self._NoneIfNotSet(self._actor) + return self._actor.value @property def created_at(self): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def id(self): """ :type: string """ - return self._NoneIfNotSet(self._id) + return self._id.value @property def org(self): """ :type: :class:`github.Organization.Organization` """ - return self._NoneIfNotSet(self._org) + return self._org.value @property def payload(self): """ :type: dict """ - return self._NoneIfNotSet(self._payload) + return self._payload.value @property def public(self): """ :type: bool """ - return self._NoneIfNotSet(self._public) + return self._public.value @property def repo(self): """ :type: :class:`github.Repository.Repository` """ - return self._NoneIfNotSet(self._repo) + return self._repo.value @property def type(self): """ :type: string """ - return self._NoneIfNotSet(self._type) + return self._type.value def _initAttributes(self): self._actor = github.GithubObject.NotSet @@ -106,25 +106,25 @@ class Event(github.GithubObject.NonCompletableGithubObject): 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["actor"], completed=False) + self._actor = github.GithubObject.ValuedAttribute(None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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 = self._parseDatetime(attributes["created_at"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(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 github.Organization.Organization(self._requester, self._headers, attributes["org"], completed=False) + self._org = github.GithubObject.ValuedAttribute(None if attributes["org"] is None else github.Organization.Organization(self._requester, self._headers, 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"] + self._payload = github.GithubObject.ValuedAttribute(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"] + self._public = github.GithubObject.ValuedAttribute(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 github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False) + self._repo = github.GithubObject.ValuedAttribute(None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, 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"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) diff --git a/github/File.py b/github/File.py index 600f1e5f..ce9f0df8 100644 --- a/github/File.py +++ b/github/File.py @@ -37,70 +37,70 @@ class File(github.GithubObject.NonCompletableGithubObject): """ :type: integer """ - return self._NoneIfNotSet(self._additions) + return self._additions.value @property def blob_url(self): """ :type: string """ - return self._NoneIfNotSet(self._blob_url) + return self._blob_url.value @property def changes(self): """ :type: integer """ - return self._NoneIfNotSet(self._changes) + return self._changes.value @property def contents_url(self): """ :type: string """ - return self._NoneIfNotSet(self._contents_url) + return self._contents_url.value @property def deletions(self): """ :type: integer """ - return self._NoneIfNotSet(self._deletions) + return self._deletions.value @property def filename(self): """ :type: string """ - return self._NoneIfNotSet(self._filename) + return self._filename.value @property def patch(self): """ :type: string """ - return self._NoneIfNotSet(self._patch) + return self._patch.value @property def raw_url(self): """ :type: string """ - return self._NoneIfNotSet(self._raw_url) + return self._raw_url.value @property def sha(self): """ :type: string """ - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def status(self): """ :type: string """ - return self._NoneIfNotSet(self._status) + return self._status.value def _initAttributes(self): self._additions = github.GithubObject.NotSet @@ -117,31 +117,31 @@ class File(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] - self._additions = attributes["additions"] + self._additions = github.GithubObject.ValuedAttribute(attributes["additions"]) if "blob_url" in attributes: # pragma no branch assert attributes["blob_url"] is None or isinstance(attributes["blob_url"], (str, unicode)), attributes["blob_url"] - self._blob_url = attributes["blob_url"] + self._blob_url = github.GithubObject.ValuedAttribute(attributes["blob_url"]) if "changes" in attributes: # pragma no branch assert attributes["changes"] is None or isinstance(attributes["changes"], (int, long)), attributes["changes"] - self._changes = attributes["changes"] + self._changes = github.GithubObject.ValuedAttribute(attributes["changes"]) if "contents_url" in attributes: # pragma no branch assert attributes["contents_url"] is None or isinstance(attributes["contents_url"], (str, unicode)), attributes["contents_url"] - self._contents_url = attributes["contents_url"] + self._contents_url = github.GithubObject.ValuedAttribute(attributes["contents_url"]) if "deletions" in attributes: # pragma no branch assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] - self._deletions = attributes["deletions"] + self._deletions = github.GithubObject.ValuedAttribute(attributes["deletions"]) if "filename" in attributes: # pragma no branch assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"] - self._filename = attributes["filename"] + self._filename = github.GithubObject.ValuedAttribute(attributes["filename"]) if "patch" in attributes: # pragma no branch assert attributes["patch"] is None or isinstance(attributes["patch"], (str, unicode)), attributes["patch"] - self._patch = attributes["patch"] + self._patch = github.GithubObject.ValuedAttribute(attributes["patch"]) if "raw_url" in attributes: # pragma no branch assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"] - self._raw_url = attributes["raw_url"] + self._raw_url = github.GithubObject.ValuedAttribute(attributes["raw_url"]) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "status" in attributes: # pragma no branch assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] - self._status = attributes["status"] + self._status = github.GithubObject.ValuedAttribute(attributes["status"]) diff --git a/github/Gist.py b/github/Gist.py index 1b2f6d35..e91d9350 100644 --- a/github/Gist.py +++ b/github/Gist.py @@ -45,7 +45,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._comments) - return self._NoneIfNotSet(self._comments) + return self._comments.value @property def comments_url(self): @@ -53,7 +53,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def commits_url(self): @@ -61,7 +61,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commits_url) - return self._NoneIfNotSet(self._commits_url) + return self._commits_url.value @property def created_at(self): @@ -69,7 +69,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def description(self): @@ -77,7 +77,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._description) - return self._NoneIfNotSet(self._description) + return self._description.value @property def files(self): @@ -85,7 +85,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: dict of string to :class:`github.GistFile.GistFile` """ self._completeIfNotSet(self._files) - return self._NoneIfNotSet(self._files) + return self._files.value @property def fork_of(self): @@ -93,7 +93,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: :class:`github.Gist.Gist` """ self._completeIfNotSet(self._fork_of) - return self._NoneIfNotSet(self._fork_of) + return self._fork_of.value @property def forks(self): @@ -101,7 +101,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.Gist.Gist` """ self._completeIfNotSet(self._forks) - return self._NoneIfNotSet(self._forks) + return self._forks.value @property def forks_url(self): @@ -109,7 +109,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._forks_url) - return self._NoneIfNotSet(self._forks_url) + return self._forks_url.value @property def git_pull_url(self): @@ -117,7 +117,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_pull_url) - return self._NoneIfNotSet(self._git_pull_url) + return self._git_pull_url.value @property def git_push_url(self): @@ -125,7 +125,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_push_url) - return self._NoneIfNotSet(self._git_push_url) + return self._git_push_url.value @property def history(self): @@ -133,7 +133,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.GistHistoryState.GistHistoryState` """ self._completeIfNotSet(self._history) - return self._NoneIfNotSet(self._history) + return self._history.value @property def html_url(self): @@ -141,7 +141,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -149,7 +149,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def public(self): @@ -157,7 +157,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._public) - return self._NoneIfNotSet(self._public) + return self._public.value @property def updated_at(self): @@ -165,7 +165,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -173,7 +173,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -181,7 +181,7 @@ class Gist(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def create_comment(self, body): """ @@ -321,64 +321,64 @@ class Gist(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] - self._comments = attributes["comments"] + self._comments = github.GithubObject.ValuedAttribute(attributes["comments"]) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_url"]) if "commits_url" in attributes: # pragma no branch assert attributes["commits_url"] is None or isinstance(attributes["commits_url"], (str, unicode)), attributes["commits_url"] - self._commits_url = attributes["commits_url"] + self._commits_url = github.GithubObject.ValuedAttribute(attributes["commits_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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._description = github.GithubObject.ValuedAttribute(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( + self._files = github.GithubObject.ValuedAttribute(None if attributes["files"] is None else dict( (key, github.GistFile.GistFile(self._requester, self._headers, 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, self._headers, attributes["fork_of"], completed=False) + self._fork_of = github.GithubObject.ValuedAttribute(None if attributes["fork_of"] is None else Gist(self._requester, self._headers, 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 [ + self._forks = github.GithubObject.ValuedAttribute(None if attributes["forks"] is None else [ Gist(self._requester, self._headers, element, completed=False) for element in attributes["forks"] - ] + ]) if "forks_url" in attributes: # pragma no branch assert attributes["forks_url"] is None or isinstance(attributes["forks_url"], (str, unicode)), attributes["forks_url"] - self._forks_url = attributes["forks_url"] + self._forks_url = github.GithubObject.ValuedAttribute(attributes["forks_url"]) 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"] + self._git_pull_url = github.GithubObject.ValuedAttribute(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"] + self._git_push_url = github.GithubObject.ValuedAttribute(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 [ + self._history = github.GithubObject.ValuedAttribute(None if attributes["history"] is None else [ github.GistHistoryState.GistHistoryState(self._requester, self._headers, 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._public = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["updated_at"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/GistComment.py b/github/GistComment.py index 5ee0664c..5a4819e8 100644 --- a/github/GistComment.py +++ b/github/GistComment.py @@ -40,7 +40,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def created_at(self): @@ -48,7 +48,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def id(self): @@ -56,7 +56,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def updated_at(self): @@ -64,7 +64,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -72,7 +72,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -80,7 +80,7 @@ class GistComment(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def delete(self): """ @@ -120,19 +120,19 @@ class GistComment(github.GithubObject.CompletableGithubObject): 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"] + self._body = github.GithubObject.ValuedAttribute(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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/GistFile.py b/github/GistFile.py index 1070d7f3..3570dc47 100644 --- a/github/GistFile.py +++ b/github/GistFile.py @@ -37,42 +37,42 @@ class GistFile(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._content) + return self._content.value @property def filename(self): """ :type: string """ - return self._NoneIfNotSet(self._filename) + return self._filename.value @property def language(self): """ :type: string """ - return self._NoneIfNotSet(self._language) + return self._language.value @property def raw_url(self): """ :type: string """ - return self._NoneIfNotSet(self._raw_url) + return self._raw_url.value @property def size(self): """ :type: integer """ - return self._NoneIfNotSet(self._size) + return self._size.value @property def type(self): """ :type: string """ - return self._NoneIfNotSet(self._type) + return self._type.value def _initAttributes(self): self._content = github.GithubObject.NotSet @@ -85,19 +85,19 @@ class GistFile(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] - self._content = attributes["content"] + self._content = github.GithubObject.ValuedAttribute(attributes["content"]) if "filename" in attributes: # pragma no branch assert attributes["filename"] is None or isinstance(attributes["filename"], (str, unicode)), attributes["filename"] - self._filename = attributes["filename"] + self._filename = github.GithubObject.ValuedAttribute(attributes["filename"]) if "language" in attributes: # pragma no branch assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"] - self._language = attributes["language"] + self._language = github.GithubObject.ValuedAttribute(attributes["language"]) if "raw_url" in attributes: # pragma no branch assert attributes["raw_url"] is None or isinstance(attributes["raw_url"], (str, unicode)), attributes["raw_url"] - self._raw_url = attributes["raw_url"] + self._raw_url = github.GithubObject.ValuedAttribute(attributes["raw_url"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] - self._size = attributes["size"] + self._size = github.GithubObject.ValuedAttribute(attributes["size"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) diff --git a/github/GistHistoryState.py b/github/GistHistoryState.py index cd5d2dc9..8e2c2836 100644 --- a/github/GistHistoryState.py +++ b/github/GistHistoryState.py @@ -42,7 +42,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: :class:`github.CommitStats.CommitStats` """ self._completeIfNotSet(self._change_status) - return self._NoneIfNotSet(self._change_status) + return self._change_status.value @property def comments(self): @@ -50,7 +50,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._comments) - return self._NoneIfNotSet(self._comments) + return self._comments.value @property def comments_url(self): @@ -58,7 +58,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def commits_url(self): @@ -66,7 +66,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commits_url) - return self._NoneIfNotSet(self._commits_url) + return self._commits_url.value @property def committed_at(self): @@ -74,7 +74,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._committed_at) - return self._NoneIfNotSet(self._committed_at) + return self._committed_at.value @property def created_at(self): @@ -82,7 +82,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def description(self): @@ -90,7 +90,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._description) - return self._NoneIfNotSet(self._description) + return self._description.value @property def files(self): @@ -98,7 +98,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: dict of string to :class:`github.GistFile.GistFile` """ self._completeIfNotSet(self._files) - return self._NoneIfNotSet(self._files) + return self._files.value @property def forks(self): @@ -106,7 +106,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.Gist.Gist` """ self._completeIfNotSet(self._forks) - return self._NoneIfNotSet(self._forks) + return self._forks.value @property def forks_url(self): @@ -114,7 +114,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._forks_url) - return self._NoneIfNotSet(self._forks_url) + return self._forks_url.value @property def git_pull_url(self): @@ -122,7 +122,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_pull_url) - return self._NoneIfNotSet(self._git_pull_url) + return self._git_pull_url.value @property def git_push_url(self): @@ -130,7 +130,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_push_url) - return self._NoneIfNotSet(self._git_push_url) + return self._git_push_url.value @property def history(self): @@ -138,7 +138,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: list of :class:`GistHistoryState` """ self._completeIfNotSet(self._history) - return self._NoneIfNotSet(self._history) + return self._history.value @property def html_url(self): @@ -146,7 +146,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -154,7 +154,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def public(self): @@ -162,7 +162,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._public) - return self._NoneIfNotSet(self._public) + return self._public.value @property def updated_at(self): @@ -170,7 +170,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -178,7 +178,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -186,7 +186,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value @property def version(self): @@ -194,7 +194,7 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._version) - return self._NoneIfNotSet(self._version) + return self._version.value def _initAttributes(self): self._change_status = github.GithubObject.NotSet @@ -221,70 +221,70 @@ class GistHistoryState(github.GithubObject.CompletableGithubObject): 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 github.CommitStats.CommitStats(self._requester, self._headers, attributes["change_status"], completed=False) + self._change_status = github.GithubObject.ValuedAttribute(None if attributes["change_status"] is None else github.CommitStats.CommitStats(self._requester, self._headers, attributes["change_status"], 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"] + self._comments = github.GithubObject.ValuedAttribute(attributes["comments"]) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_url"]) if "commits_url" in attributes: # pragma no branch assert attributes["commits_url"] is None or isinstance(attributes["commits_url"], (str, unicode)), attributes["commits_url"] - self._commits_url = attributes["commits_url"] + self._commits_url = github.GithubObject.ValuedAttribute(attributes["commits_url"]) 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 = self._parseDatetime(attributes["committed_at"]) + self._committed_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["committed_at"])) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._description = github.GithubObject.ValuedAttribute(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( + self._files = github.GithubObject.ValuedAttribute(None if attributes["files"] is None else dict( (key, github.GistFile.GistFile(self._requester, self._headers, element, completed=False)) for key, element in attributes["files"].iteritems() - ) + )) 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 [ + self._forks = github.GithubObject.ValuedAttribute(None if attributes["forks"] is None else [ github.Gist.Gist(self._requester, self._headers, element, completed=False) for element in attributes["forks"] - ] + ]) if "forks_url" in attributes: # pragma no branch assert attributes["forks_url"] is None or isinstance(attributes["forks_url"], (str, unicode)), attributes["forks_url"] - self._forks_url = attributes["forks_url"] + self._forks_url = github.GithubObject.ValuedAttribute(attributes["forks_url"]) 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"] + self._git_pull_url = github.GithubObject.ValuedAttribute(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"] + self._git_push_url = github.GithubObject.ValuedAttribute(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 [ + self._history = github.GithubObject.ValuedAttribute(None if attributes["history"] is None else [ GistHistoryState(self._requester, self._headers, 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._public = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["updated_at"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._version = github.GithubObject.ValuedAttribute(attributes["version"]) diff --git a/github/GitAuthor.py b/github/GitAuthor.py index e56ce94d..4c63ac51 100644 --- a/github/GitAuthor.py +++ b/github/GitAuthor.py @@ -37,21 +37,21 @@ class GitAuthor(github.GithubObject.NonCompletableGithubObject): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._date) + return self._date.value @property def email(self): """ :type: string """ - return self._NoneIfNotSet(self._email) + return self._email.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value def _initAttributes(self): self._date = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class GitAuthor(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "date" in attributes: # pragma no branch assert attributes["date"] is None or isinstance(attributes["date"], (str, unicode)), attributes["date"] - self._date = self._parseDatetime(attributes["date"]) + self._date = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["date"])) if "email" in attributes: # pragma no branch assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] - self._email = attributes["email"] + self._email = github.GithubObject.ValuedAttribute(attributes["email"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) diff --git a/github/GitBlob.py b/github/GitBlob.py index 8f105682..1fa4df49 100644 --- a/github/GitBlob.py +++ b/github/GitBlob.py @@ -38,7 +38,7 @@ class GitBlob(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._content) - return self._NoneIfNotSet(self._content) + return self._content.value @property def encoding(self): @@ -46,7 +46,7 @@ class GitBlob(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._encoding) - return self._NoneIfNotSet(self._encoding) + return self._encoding.value @property def sha(self): @@ -54,7 +54,7 @@ class GitBlob(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def size(self): @@ -62,7 +62,7 @@ class GitBlob(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._size) - return self._NoneIfNotSet(self._size) + return self._size.value @property def url(self): @@ -70,7 +70,7 @@ class GitBlob(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._content = github.GithubObject.NotSet @@ -82,16 +82,16 @@ class GitBlob(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "content" in attributes: # pragma no branch assert attributes["content"] is None or isinstance(attributes["content"], (str, unicode)), attributes["content"] - self._content = attributes["content"] + self._content = github.GithubObject.ValuedAttribute(attributes["content"]) if "encoding" in attributes: # pragma no branch assert attributes["encoding"] is None or isinstance(attributes["encoding"], (str, unicode)), attributes["encoding"] - self._encoding = attributes["encoding"] + self._encoding = github.GithubObject.ValuedAttribute(attributes["encoding"]) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] - self._size = attributes["size"] + self._size = github.GithubObject.ValuedAttribute(attributes["size"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitCommit.py b/github/GitCommit.py index 1d8c3eb4..d18bf64c 100644 --- a/github/GitCommit.py +++ b/github/GitCommit.py @@ -41,7 +41,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitAuthor.GitAuthor` """ self._completeIfNotSet(self._author) - return self._NoneIfNotSet(self._author) + return self._author.value @property def committer(self): @@ -49,7 +49,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitAuthor.GitAuthor` """ self._completeIfNotSet(self._committer) - return self._NoneIfNotSet(self._committer) + return self._committer.value @property def html_url(self): @@ -57,7 +57,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def message(self): @@ -65,7 +65,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._message) - return self._NoneIfNotSet(self._message) + return self._message.value @property def parents(self): @@ -73,7 +73,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.GitCommit.GitCommit` """ self._completeIfNotSet(self._parents) - return self._NoneIfNotSet(self._parents) + return self._parents.value @property def sha(self): @@ -81,7 +81,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def tree(self): @@ -89,7 +89,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitTree.GitTree` """ self._completeIfNotSet(self._tree) - return self._NoneIfNotSet(self._tree) + return self._tree.value @property def url(self): @@ -97,7 +97,7 @@ class GitCommit(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def _identity(self): @@ -116,28 +116,28 @@ class GitCommit(github.GithubObject.CompletableGithubObject): 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 github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["author"], completed=False) + self._author = github.GithubObject.ValuedAttribute(None if attributes["author"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["author"], 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 github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["committer"], completed=False) + self._committer = github.GithubObject.ValuedAttribute(None if attributes["committer"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["committer"], 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_url"]) if "message" in attributes: # pragma no branch assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] - self._message = attributes["message"] + self._message = github.GithubObject.ValuedAttribute(attributes["message"]) 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 [ + self._parents = github.GithubObject.ValuedAttribute(None if attributes["parents"] is None else [ GitCommit(self._requester, self._headers, 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"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "tree" in attributes: # pragma no branch assert attributes["tree"] is None or isinstance(attributes["tree"], dict), attributes["tree"] - self._tree = None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, self._headers, attributes["tree"], completed=False) + self._tree = github.GithubObject.ValuedAttribute(None if attributes["tree"] is None else github.GitTree.GitTree(self._requester, self._headers, attributes["tree"], 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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitObject.py b/github/GitObject.py index a7314641..28b474cb 100644 --- a/github/GitObject.py +++ b/github/GitObject.py @@ -37,21 +37,21 @@ class GitObject(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def type(self): """ :type: string """ - return self._NoneIfNotSet(self._type) + return self._type.value @property def url(self): """ :type: string """ - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._sha = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class GitObject(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitRef.py b/github/GitRef.py index 97a2ca4d..b71411aa 100644 --- a/github/GitRef.py +++ b/github/GitRef.py @@ -40,7 +40,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitObject.GitObject` """ self._completeIfNotSet(self._object) - return self._NoneIfNotSet(self._object) + return self._object.value @property def ref(self): @@ -48,7 +48,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._ref) - return self._NoneIfNotSet(self._ref) + return self._ref.value @property def url(self): @@ -56,7 +56,7 @@ class GitRef(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -97,10 +97,10 @@ class GitRef(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "object" in attributes: # pragma no branch assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] - self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], completed=False) + self._object = github.GithubObject.ValuedAttribute(None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], completed=False)) if "ref" in attributes: # pragma no branch assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"] - self._ref = attributes["ref"] + self._ref = github.GithubObject.ValuedAttribute(attributes["ref"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitTag.py b/github/GitTag.py index 564b6b86..03334d6b 100644 --- a/github/GitTag.py +++ b/github/GitTag.py @@ -41,7 +41,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._message) - return self._NoneIfNotSet(self._message) + return self._message.value @property def object(self): @@ -49,7 +49,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitObject.GitObject` """ self._completeIfNotSet(self._object) - return self._NoneIfNotSet(self._object) + return self._object.value @property def sha(self): @@ -57,7 +57,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def tag(self): @@ -65,7 +65,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._tag) - return self._NoneIfNotSet(self._tag) + return self._tag.value @property def tagger(self): @@ -73,7 +73,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: :class:`github.GitAuthor.GitAuthor` """ self._completeIfNotSet(self._tagger) - return self._NoneIfNotSet(self._tagger) + return self._tagger.value @property def url(self): @@ -81,7 +81,7 @@ class GitTag(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._message = github.GithubObject.NotSet @@ -94,19 +94,19 @@ class GitTag(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "message" in attributes: # pragma no branch assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] - self._message = attributes["message"] + self._message = github.GithubObject.ValuedAttribute(attributes["message"]) if "object" in attributes: # pragma no branch assert attributes["object"] is None or isinstance(attributes["object"], dict), attributes["object"] - self._object = None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], completed=False) + self._object = github.GithubObject.ValuedAttribute(None if attributes["object"] is None else github.GitObject.GitObject(self._requester, self._headers, attributes["object"], 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"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "tag" in attributes: # pragma no branch assert attributes["tag"] is None or isinstance(attributes["tag"], (str, unicode)), attributes["tag"] - self._tag = attributes["tag"] + self._tag = github.GithubObject.ValuedAttribute(attributes["tag"]) if "tagger" in attributes: # pragma no branch assert attributes["tagger"] is None or isinstance(attributes["tagger"], dict), attributes["tagger"] - self._tagger = None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["tagger"], completed=False) + self._tagger = github.GithubObject.ValuedAttribute(None if attributes["tagger"] is None else github.GitAuthor.GitAuthor(self._requester, self._headers, attributes["tagger"], 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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitTree.py b/github/GitTree.py index b06c5e82..8ceefdea 100644 --- a/github/GitTree.py +++ b/github/GitTree.py @@ -40,7 +40,7 @@ class GitTree(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._sha) - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def tree(self): @@ -48,7 +48,7 @@ class GitTree(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.GitTreeElement.GitTreeElement` """ self._completeIfNotSet(self._tree) - return self._NoneIfNotSet(self._tree) + return self._tree.value @property def url(self): @@ -56,7 +56,7 @@ class GitTree(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def _identity(self): @@ -70,13 +70,13 @@ class GitTree(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "tree" in attributes: # pragma no branch assert attributes["tree"] is None or all(isinstance(element, dict) for element in attributes["tree"]), attributes["tree"] - self._tree = None if attributes["tree"] is None else [ + self._tree = github.GithubObject.ValuedAttribute(None if attributes["tree"] is None else [ github.GitTreeElement.GitTreeElement(self._requester, self._headers, element, completed=False) for element in attributes["tree"] - ] + ]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GitTreeElement.py b/github/GitTreeElement.py index e7ae76bb..e0638198 100644 --- a/github/GitTreeElement.py +++ b/github/GitTreeElement.py @@ -37,42 +37,42 @@ class GitTreeElement(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._mode) + return self._mode.value @property def path(self): """ :type: string """ - return self._NoneIfNotSet(self._path) + return self._path.value @property def sha(self): """ :type: string """ - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def size(self): """ :type: integer """ - return self._NoneIfNotSet(self._size) + return self._size.value @property def type(self): """ :type: string """ - return self._NoneIfNotSet(self._type) + return self._type.value @property def url(self): """ :type: string """ - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._mode = github.GithubObject.NotSet @@ -85,19 +85,19 @@ class GitTreeElement(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "mode" in attributes: # pragma no branch assert attributes["mode"] is None or isinstance(attributes["mode"], (str, unicode)), attributes["mode"] - self._mode = attributes["mode"] + self._mode = github.GithubObject.ValuedAttribute(attributes["mode"]) if "path" in attributes: # pragma no branch assert attributes["path"] is None or isinstance(attributes["path"], (str, unicode)), attributes["path"] - self._path = attributes["path"] + self._path = github.GithubObject.ValuedAttribute(attributes["path"]) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) if "size" in attributes: # pragma no branch assert attributes["size"] is None or isinstance(attributes["size"], (int, long)), attributes["size"] - self._size = attributes["size"] + self._size = github.GithubObject.ValuedAttribute(attributes["size"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/GithubObject.py b/github/GithubObject.py index 91c079b7..7467f6e7 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -33,9 +33,16 @@ import Consts class _NotSetType: def __repr__(self): return "NotSet" + + value = None NotSet = _NotSetType() +class ValuedAttribute: + def __init__(self, value): + self.value = value + + class GithubObject(object): """ Base class for all classes representing objects returned by the API. @@ -87,13 +94,6 @@ class GithubObject(object): def _parentUrl(url): return "/".join(url.split("/")[: -1]) - @staticmethod - def _NoneIfNotSet(value): - if value is NotSet: - return None - else: - return value - @staticmethod def _parseDatetime(s): if s is None: @@ -141,7 +141,7 @@ class CompletableGithubObject(GithubObject): def __complete(self): headers, data = self._requester.requestJsonAndCheck( "GET", - self._url + self._url.value ) self._storeAndUseAttributes(headers, data) self.__completed = True @@ -159,7 +159,7 @@ class CompletableGithubObject(GithubObject): status, responseHeaders, output = self._requester.requestJson( "GET", - self._url, + self._url.value, headers=conditionalRequestHeader ) if status == 304: diff --git a/github/GitignoreTemplate.py b/github/GitignoreTemplate.py index a8a7022f..c0496e49 100644 --- a/github/GitignoreTemplate.py +++ b/github/GitignoreTemplate.py @@ -36,14 +36,14 @@ class GitignoreTemplate(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._source) + return self._source.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value def _initAttributes(self): self._source = github.GithubObject.NotSet @@ -52,7 +52,7 @@ class GitignoreTemplate(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "source" in attributes: # pragma no branch assert attributes["source"] is None or isinstance(attributes["source"], (str, unicode)), attributes["source"] - self._source = attributes["source"] + self._source = github.GithubObject.ValuedAttribute(attributes["source"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) diff --git a/github/Hook.py b/github/Hook.py index 4778c41f..42387adb 100644 --- a/github/Hook.py +++ b/github/Hook.py @@ -40,7 +40,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._active) - return self._NoneIfNotSet(self._active) + return self._active.value @property def config(self): @@ -48,7 +48,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: dict """ self._completeIfNotSet(self._config) - return self._NoneIfNotSet(self._config) + return self._config.value @property def created_at(self): @@ -56,7 +56,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def events(self): @@ -64,7 +64,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: list of string """ self._completeIfNotSet(self._events) - return self._NoneIfNotSet(self._events) + return self._events.value @property def id(self): @@ -72,7 +72,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def last_response(self): @@ -80,7 +80,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: :class:`github.HookResponse.HookResponse` """ self._completeIfNotSet(self._last_response) - return self._NoneIfNotSet(self._last_response) + return self._last_response.value @property def name(self): @@ -88,7 +88,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def test_url(self): @@ -96,7 +96,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._test_url) - return self._NoneIfNotSet(self._test_url) + return self._test_url.value @property def updated_at(self): @@ -104,7 +104,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -112,7 +112,7 @@ class Hook(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -185,31 +185,31 @@ class Hook(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "active" in attributes: # pragma no branch assert attributes["active"] is None or isinstance(attributes["active"], bool), attributes["active"] - self._active = attributes["active"] + self._active = github.GithubObject.ValuedAttribute(attributes["active"]) if "config" in attributes: # pragma no branch assert attributes["config"] is None or isinstance(attributes["config"], dict), attributes["config"] - self._config = attributes["config"] + self._config = github.GithubObject.ValuedAttribute(attributes["config"]) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "events" in attributes: # pragma no branch assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"] - self._events = attributes["events"] + self._events = github.GithubObject.ValuedAttribute(attributes["events"]) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "last_response" in attributes: # pragma no branch assert attributes["last_response"] is None or isinstance(attributes["last_response"], dict), attributes["last_response"] - self._last_response = None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, self._headers, attributes["last_response"], completed=False) + self._last_response = github.GithubObject.ValuedAttribute(None if attributes["last_response"] is None else github.HookResponse.HookResponse(self._requester, self._headers, attributes["last_response"], completed=False)) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "test_url" in attributes: # pragma no branch assert attributes["test_url"] is None or isinstance(attributes["test_url"], (str, unicode)), attributes["test_url"] - self._test_url = attributes["test_url"] + self._test_url = github.GithubObject.ValuedAttribute(attributes["test_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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/HookDescription.py b/github/HookDescription.py index 5653492b..16927306 100644 --- a/github/HookDescription.py +++ b/github/HookDescription.py @@ -37,28 +37,28 @@ class HookDescription(github.GithubObject.NonCompletableGithubObject): """ :type: list of string """ - return self._NoneIfNotSet(self._events) + return self._events.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value @property def schema(self): """ :type: list of list of string """ - return self._NoneIfNotSet(self._schema) + return self._schema.value @property def supported_events(self): """ :type: list of string """ - return self._NoneIfNotSet(self._supported_events) + return self._supported_events.value def _initAttributes(self): self._events = github.GithubObject.NotSet @@ -69,13 +69,13 @@ class HookDescription(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "events" in attributes: # pragma no branch assert attributes["events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["events"]), attributes["events"] - self._events = attributes["events"] + self._events = github.GithubObject.ValuedAttribute(attributes["events"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "schema" in attributes: # pragma no branch assert attributes["schema"] is None or all(isinstance(element, list) for element in attributes["schema"]), attributes["schema"] - self._schema = attributes["schema"] + self._schema = github.GithubObject.ValuedAttribute(attributes["schema"]) if "supported_events" in attributes: # pragma no branch assert attributes["supported_events"] is None or all(isinstance(element, (str, unicode)) for element in attributes["supported_events"]), attributes["supported_events"] - self._supported_events = attributes["supported_events"] + self._supported_events = github.GithubObject.ValuedAttribute(attributes["supported_events"]) diff --git a/github/HookResponse.py b/github/HookResponse.py index 41e242b3..b8b04e53 100644 --- a/github/HookResponse.py +++ b/github/HookResponse.py @@ -37,21 +37,21 @@ class HookResponse(github.GithubObject.NonCompletableGithubObject): """ :type: integer """ - return self._NoneIfNotSet(self._code) + return self._code.value @property def message(self): """ :type: string """ - return self._NoneIfNotSet(self._message) + return self._message.value @property def status(self): """ :type: string """ - return self._NoneIfNotSet(self._status) + return self._status.value def _initAttributes(self): self._code = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class HookResponse(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "code" in attributes: # pragma no branch assert attributes["code"] is None or isinstance(attributes["code"], (int, long)), attributes["code"] - self._code = attributes["code"] + self._code = github.GithubObject.ValuedAttribute(attributes["code"]) if "message" in attributes: # pragma no branch assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] - self._message = attributes["message"] + self._message = github.GithubObject.ValuedAttribute(attributes["message"]) if "status" in attributes: # pragma no branch assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] - self._status = attributes["status"] + self._status = github.GithubObject.ValuedAttribute(attributes["status"]) diff --git a/github/Issue.py b/github/Issue.py index b0be8e35..1f95a929 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -50,7 +50,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._assignee) - return self._NoneIfNotSet(self._assignee) + return self._assignee.value @property def body(self): @@ -58,7 +58,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def closed_at(self): @@ -66,7 +66,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._closed_at) - return self._NoneIfNotSet(self._closed_at) + return self._closed_at.value @property def closed_by(self): @@ -74,7 +74,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._closed_by) - return self._NoneIfNotSet(self._closed_by) + return self._closed_by.value @property def comments(self): @@ -82,7 +82,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._comments) - return self._NoneIfNotSet(self._comments) + return self._comments.value @property def comments_url(self): @@ -90,7 +90,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def created_at(self): @@ -98,7 +98,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def events_url(self): @@ -106,7 +106,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._events_url) - return self._NoneIfNotSet(self._events_url) + return self._events_url.value @property def html_url(self): @@ -114,7 +114,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -122,7 +122,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def labels(self): @@ -130,7 +130,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: list of :class:`github.Label.Label` """ self._completeIfNotSet(self._labels) - return self._NoneIfNotSet(self._labels) + return self._labels.value @property def labels_url(self): @@ -138,7 +138,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._labels_url) - return self._NoneIfNotSet(self._labels_url) + return self._labels_url.value @property def milestone(self): @@ -146,7 +146,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: :class:`github.Milestone.Milestone` """ self._completeIfNotSet(self._milestone) - return self._NoneIfNotSet(self._milestone) + return self._milestone.value @property def number(self): @@ -154,7 +154,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._number) - return self._NoneIfNotSet(self._number) + return self._number.value @property def pull_request(self): @@ -162,7 +162,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: :class:`github.IssuePullRequest.IssuePullRequest` """ self._completeIfNotSet(self._pull_request) - return self._NoneIfNotSet(self._pull_request) + return self._pull_request.value @property def repository(self): @@ -173,8 +173,8 @@ class Issue(github.GithubObject.CompletableGithubObject): if self._repository is github.GithubObject.NotSet: # The repository was not set automatically, so it must be looked up by url. repo_url = "/".join(self.url.split("/")[:-2]) - self._repository = github.Repository.Repository(self._requester, self._headers, {'url': repo_url}, completed=False) - return self._repository + self._repository = github.GithubObject.ValuedAttribute(github.Repository.Repository(self._requester, self._headers, {'url': repo_url}, completed=False)) + return self._repository.value @property def state(self): @@ -182,7 +182,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._state) - return self._NoneIfNotSet(self._state) + return self._state.value @property def title(self): @@ -190,7 +190,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._title) - return self._NoneIfNotSet(self._title) + return self._title.value @property def updated_at(self): @@ -198,7 +198,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -206,7 +206,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -214,7 +214,7 @@ class Issue(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def add_to_labels(self, *labels): """ @@ -399,67 +399,67 @@ class Issue(github.GithubObject.CompletableGithubObject): 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["assignee"], completed=False) + self._assignee = github.GithubObject.ValuedAttribute(None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._body = github.GithubObject.ValuedAttribute(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"]) + self._closed_at = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["closed_by"], completed=False) + self._closed_by = github.GithubObject.ValuedAttribute(None if attributes["closed_by"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._comments = github.GithubObject.ValuedAttribute(attributes["comments"]) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "events_url" in attributes: # pragma no branch assert attributes["events_url"] is None or isinstance(attributes["events_url"], (str, unicode)), attributes["events_url"] - self._events_url = attributes["events_url"] + self._events_url = github.GithubObject.ValuedAttribute(attributes["events_url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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 [ + self._labels = github.GithubObject.ValuedAttribute(None if attributes["labels"] is None else [ github.Label.Label(self._requester, self._headers, element, completed=False) for element in attributes["labels"] - ] + ]) if "labels_url" in attributes: # pragma no branch assert attributes["labels_url"] is None or isinstance(attributes["labels_url"], (str, unicode)), attributes["labels_url"] - self._labels_url = attributes["labels_url"] + self._labels_url = github.GithubObject.ValuedAttribute(attributes["labels_url"]) 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 github.Milestone.Milestone(self._requester, self._headers, attributes["milestone"], completed=False) + self._milestone = github.GithubObject.ValuedAttribute(None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, self._headers, 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"] + self._number = github.GithubObject.ValuedAttribute(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 github.IssuePullRequest.IssuePullRequest(self._requester, self._headers, attributes["pull_request"], completed=False) + self._pull_request = github.GithubObject.ValuedAttribute(None if attributes["pull_request"] is None else github.IssuePullRequest.IssuePullRequest(self._requester, self._headers, 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 github.Repository.Repository(self._requester, self._headers, attributes["repository"], completed=False) + self._repository = github.GithubObject.ValuedAttribute(None if attributes["repository"] is None else github.Repository.Repository(self._requester, self._headers, 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"] + self._state = github.GithubObject.ValuedAttribute(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"] + self._title = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/IssueComment.py b/github/IssueComment.py index 84482c70..c5739592 100644 --- a/github/IssueComment.py +++ b/github/IssueComment.py @@ -41,7 +41,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def created_at(self): @@ -49,7 +49,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def id(self): @@ -57,7 +57,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def issue_url(self): @@ -65,7 +65,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._issue_url) - return self._NoneIfNotSet(self._issue_url) + return self._issue_url.value @property def updated_at(self): @@ -73,7 +73,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -81,7 +81,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def html_url(self): @@ -89,7 +89,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def user(self): @@ -97,7 +97,7 @@ class IssueComment(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def delete(self): """ @@ -139,25 +139,25 @@ class IssueComment(github.GithubObject.CompletableGithubObject): 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"] + self._body = github.GithubObject.ValuedAttribute(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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._issue_url = github.GithubObject.ValuedAttribute(attributes["issue_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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/IssueEvent.py b/github/IssueEvent.py index aca4cdf8..c95f5a87 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -41,7 +41,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._actor) - return self._NoneIfNotSet(self._actor) + return self._actor.value @property def commit_id(self): @@ -49,7 +49,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commit_id) - return self._NoneIfNotSet(self._commit_id) + return self._commit_id.value @property def created_at(self): @@ -57,7 +57,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def event(self): @@ -65,7 +65,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._event) - return self._NoneIfNotSet(self._event) + return self._event.value @property def id(self): @@ -73,7 +73,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def issue(self): @@ -81,7 +81,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: :class:`github.Issue.Issue` """ self._completeIfNotSet(self._issue) - return self._NoneIfNotSet(self._issue) + return self._issue.value @property def url(self): @@ -89,7 +89,7 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._actor = github.GithubObject.NotSet @@ -103,22 +103,22 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["actor"], completed=False) + self._actor = github.GithubObject.ValuedAttribute(None if attributes["actor"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._commit_id = github.GithubObject.ValuedAttribute(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"]) + self._created_at = github.GithubObject.ValuedAttribute(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"] + self._event = github.GithubObject.ValuedAttribute(attributes["event"]) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(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 github.Issue.Issue(self._requester, self._headers, attributes["issue"], completed=False) + self._issue = github.GithubObject.ValuedAttribute(None if attributes["issue"] is None else github.Issue.Issue(self._requester, self._headers, 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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/IssuePullRequest.py b/github/IssuePullRequest.py index ae7e6b6c..e7652ea7 100644 --- a/github/IssuePullRequest.py +++ b/github/IssuePullRequest.py @@ -37,21 +37,21 @@ class IssuePullRequest(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._diff_url) + return self._diff_url.value @property def html_url(self): """ :type: string """ - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def patch_url(self): """ :type: string """ - return self._NoneIfNotSet(self._patch_url) + return self._patch_url.value def _initAttributes(self): self._diff_url = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class IssuePullRequest(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): 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"] + self._diff_url = github.GithubObject.ValuedAttribute(attributes["diff_url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_url"]) 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"] + self._patch_url = github.GithubObject.ValuedAttribute(attributes["patch_url"]) diff --git a/github/Label.py b/github/Label.py index 813cd5f0..646443e0 100644 --- a/github/Label.py +++ b/github/Label.py @@ -41,7 +41,7 @@ class Label(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._color) - return self._NoneIfNotSet(self._color) + return self._color.value @property def name(self): @@ -49,7 +49,7 @@ class Label(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def url(self): @@ -57,7 +57,7 @@ class Label(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -101,10 +101,10 @@ class Label(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "color" in attributes: # pragma no branch assert attributes["color"] is None or isinstance(attributes["color"], (str, unicode)), attributes["color"] - self._color = attributes["color"] + self._color = github.GithubObject.ValuedAttribute(attributes["color"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Milestone.py b/github/Milestone.py index 2b414f73..e7920ca3 100644 --- a/github/Milestone.py +++ b/github/Milestone.py @@ -45,7 +45,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._closed_issues) - return self._NoneIfNotSet(self._closed_issues) + return self._closed_issues.value @property def created_at(self): @@ -53,7 +53,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def creator(self): @@ -61,7 +61,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._creator) - return self._NoneIfNotSet(self._creator) + return self._creator.value @property def description(self): @@ -69,7 +69,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._description) - return self._NoneIfNotSet(self._description) + return self._description.value @property def due_on(self): @@ -77,7 +77,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._due_on) - return self._NoneIfNotSet(self._due_on) + return self._due_on.value @property def id(self): @@ -85,7 +85,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def labels_url(self): @@ -93,7 +93,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._labels_url) - return self._NoneIfNotSet(self._labels_url) + return self._labels_url.value @property def number(self): @@ -101,7 +101,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._number) - return self._NoneIfNotSet(self._number) + return self._number.value @property def open_issues(self): @@ -109,7 +109,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._open_issues) - return self._NoneIfNotSet(self._open_issues) + return self._open_issues.value @property def state(self): @@ -117,7 +117,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._state) - return self._NoneIfNotSet(self._state) + return self._state.value @property def title(self): @@ -125,7 +125,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._title) - return self._NoneIfNotSet(self._title) + return self._title.value @property def updated_at(self): @@ -133,7 +133,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -141,7 +141,7 @@ class Milestone(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def delete(self): """ @@ -216,40 +216,40 @@ class Milestone(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "closed_issues" in attributes: # pragma no branch assert attributes["closed_issues"] is None or isinstance(attributes["closed_issues"], (int, long)), attributes["closed_issues"] - self._closed_issues = attributes["closed_issues"] + self._closed_issues = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["created_at"]) + self._created_at = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["creator"], completed=False) + self._creator = github.GithubObject.ValuedAttribute(None if attributes["creator"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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"] + self._description = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["due_on"]) + self._due_on = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["due_on"])) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "labels_url" in attributes: # pragma no branch assert attributes["labels_url"] is None or isinstance(attributes["labels_url"], (str, unicode)), attributes["labels_url"] - self._labels_url = attributes["labels_url"] + self._labels_url = github.GithubObject.ValuedAttribute(attributes["labels_url"]) if "number" in attributes: # pragma no branch assert attributes["number"] is None or isinstance(attributes["number"], (int, long)), attributes["number"] - self._number = attributes["number"] + self._number = github.GithubObject.ValuedAttribute(attributes["number"]) 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"] + self._open_issues = github.GithubObject.ValuedAttribute(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"] + self._state = github.GithubObject.ValuedAttribute(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"] + self._title = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/NamedUser.py b/github/NamedUser.py index 55bf65fd..95b7463d 100644 --- a/github/NamedUser.py +++ b/github/NamedUser.py @@ -47,7 +47,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._avatar_url) - return self._NoneIfNotSet(self._avatar_url) + return self._avatar_url.value @property def bio(self): @@ -55,7 +55,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._bio) - return self._NoneIfNotSet(self._bio) + return self._bio.value @property def blog(self): @@ -63,7 +63,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._blog) - return self._NoneIfNotSet(self._blog) + return self._blog.value @property def collaborators(self): @@ -71,7 +71,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._collaborators) - return self._NoneIfNotSet(self._collaborators) + return self._collaborators.value @property def company(self): @@ -79,7 +79,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._company) - return self._NoneIfNotSet(self._company) + return self._company.value @property def contributions(self): @@ -87,7 +87,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._contributions) - return self._NoneIfNotSet(self._contributions) + return self._contributions.value @property def created_at(self): @@ -95,7 +95,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def disk_usage(self): @@ -103,7 +103,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._disk_usage) - return self._NoneIfNotSet(self._disk_usage) + return self._disk_usage.value @property def email(self): @@ -111,7 +111,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._email) - return self._NoneIfNotSet(self._email) + return self._email.value @property def events_url(self): @@ -119,7 +119,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._events_url) - return self._NoneIfNotSet(self._events_url) + return self._events_url.value @property def followers(self): @@ -127,7 +127,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._followers) - return self._NoneIfNotSet(self._followers) + return self._followers.value @property def followers_url(self): @@ -135,7 +135,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._followers_url) - return self._NoneIfNotSet(self._followers_url) + return self._followers_url.value @property def following(self): @@ -143,7 +143,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._following) - return self._NoneIfNotSet(self._following) + return self._following.value @property def following_url(self): @@ -151,7 +151,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._following_url) - return self._NoneIfNotSet(self._following_url) + return self._following_url.value @property def gists_url(self): @@ -159,7 +159,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._gists_url) - return self._NoneIfNotSet(self._gists_url) + return self._gists_url.value @property def gravatar_id(self): @@ -167,7 +167,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._gravatar_id) - return self._NoneIfNotSet(self._gravatar_id) + return self._gravatar_id.value @property def hireable(self): @@ -175,7 +175,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._hireable) - return self._NoneIfNotSet(self._hireable) + return self._hireable.value @property def html_url(self): @@ -183,7 +183,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -191,7 +191,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def location(self): @@ -199,7 +199,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._location) - return self._NoneIfNotSet(self._location) + return self._location.value @property def login(self): @@ -207,7 +207,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._login) - return self._NoneIfNotSet(self._login) + return self._login.value @property def name(self): @@ -215,7 +215,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def organizations_url(self): @@ -223,7 +223,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._organizations_url) - return self._NoneIfNotSet(self._organizations_url) + return self._organizations_url.value @property def owned_private_repos(self): @@ -231,7 +231,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._owned_private_repos) - return self._NoneIfNotSet(self._owned_private_repos) + return self._owned_private_repos.value @property def plan(self): @@ -239,7 +239,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: :class:`github.Plan.Plan` """ self._completeIfNotSet(self._plan) - return self._NoneIfNotSet(self._plan) + return self._plan.value @property def private_gists(self): @@ -247,7 +247,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._private_gists) - return self._NoneIfNotSet(self._private_gists) + return self._private_gists.value @property def public_gists(self): @@ -255,7 +255,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_gists) - return self._NoneIfNotSet(self._public_gists) + return self._public_gists.value @property def public_repos(self): @@ -263,7 +263,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_repos) - return self._NoneIfNotSet(self._public_repos) + return self._public_repos.value @property def received_events_url(self): @@ -271,7 +271,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._received_events_url) - return self._NoneIfNotSet(self._received_events_url) + return self._received_events_url.value @property def repos_url(self): @@ -279,7 +279,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._repos_url) - return self._NoneIfNotSet(self._repos_url) + return self._repos_url.value @property def starred_url(self): @@ -287,7 +287,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._starred_url) - return self._NoneIfNotSet(self._starred_url) + return self._starred_url.value @property def subscriptions_url(self): @@ -295,7 +295,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._subscriptions_url) - return self._NoneIfNotSet(self._subscriptions_url) + return self._subscriptions_url.value @property def total_private_repos(self): @@ -303,7 +303,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._total_private_repos) - return self._NoneIfNotSet(self._total_private_repos) + return self._total_private_repos.value @property def type(self): @@ -311,7 +311,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._type) - return self._NoneIfNotSet(self._type) + return self._type.value @property def updated_at(self): @@ -319,7 +319,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -327,7 +327,7 @@ class NamedUser(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value # v2: Remove this method def create_gist(self, public, files, description=github.GithubObject.NotSet): @@ -586,109 +586,109 @@ class NamedUser(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] - self._avatar_url = attributes["avatar_url"] + self._avatar_url = github.GithubObject.ValuedAttribute(attributes["avatar_url"]) if "bio" in attributes: # pragma no branch assert attributes["bio"] is None or isinstance(attributes["bio"], (str, unicode)), attributes["bio"] - self._bio = attributes["bio"] + self._bio = github.GithubObject.ValuedAttribute(attributes["bio"]) if "blog" in attributes: # pragma no branch assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] - self._blog = attributes["blog"] + self._blog = github.GithubObject.ValuedAttribute(attributes["blog"]) if "collaborators" in attributes: # pragma no branch assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] - self._collaborators = attributes["collaborators"] + self._collaborators = github.GithubObject.ValuedAttribute(attributes["collaborators"]) if "company" in attributes: # pragma no branch assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] - self._company = attributes["company"] + self._company = github.GithubObject.ValuedAttribute(attributes["company"]) if "contributions" in attributes: # pragma no branch assert attributes["contributions"] is None or isinstance(attributes["contributions"], (int, long)), attributes["contributions"] - self._contributions = attributes["contributions"] + self._contributions = github.GithubObject.ValuedAttribute(attributes["contributions"]) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "disk_usage" in attributes: # pragma no branch assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] - self._disk_usage = attributes["disk_usage"] + self._disk_usage = github.GithubObject.ValuedAttribute(attributes["disk_usage"]) if "email" in attributes: # pragma no branch assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] - self._email = attributes["email"] + self._email = github.GithubObject.ValuedAttribute(attributes["email"]) if "events_url" in attributes: # pragma no branch assert attributes["events_url"] is None or isinstance(attributes["events_url"], (str, unicode)), attributes["events_url"] - self._events_url = attributes["events_url"] + self._events_url = github.GithubObject.ValuedAttribute(attributes["events_url"]) if "followers" in attributes: # pragma no branch assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] - self._followers = attributes["followers"] + self._followers = github.GithubObject.ValuedAttribute(attributes["followers"]) if "followers_url" in attributes: # pragma no branch assert attributes["followers_url"] is None or isinstance(attributes["followers_url"], (str, unicode)), attributes["followers_url"] - self._followers_url = attributes["followers_url"] + self._followers_url = github.GithubObject.ValuedAttribute(attributes["followers_url"]) if "following" in attributes: # pragma no branch assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] - self._following = attributes["following"] + self._following = github.GithubObject.ValuedAttribute(attributes["following"]) if "following_url" in attributes: # pragma no branch assert attributes["following_url"] is None or isinstance(attributes["following_url"], (str, unicode)), attributes["following_url"] - self._following_url = attributes["following_url"] + self._following_url = github.GithubObject.ValuedAttribute(attributes["following_url"]) if "gists_url" in attributes: # pragma no branch assert attributes["gists_url"] is None or isinstance(attributes["gists_url"], (str, unicode)), attributes["gists_url"] - self._gists_url = attributes["gists_url"] + self._gists_url = github.GithubObject.ValuedAttribute(attributes["gists_url"]) if "gravatar_id" in attributes: # pragma no branch assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] - self._gravatar_id = attributes["gravatar_id"] + self._gravatar_id = github.GithubObject.ValuedAttribute(attributes["gravatar_id"]) if "hireable" in attributes: # pragma no branch assert attributes["hireable"] is None or isinstance(attributes["hireable"], bool), attributes["hireable"] - self._hireable = attributes["hireable"] + self._hireable = github.GithubObject.ValuedAttribute(attributes["hireable"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "location" in attributes: # pragma no branch assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] - self._location = attributes["location"] + self._location = github.GithubObject.ValuedAttribute(attributes["location"]) if "login" in attributes: # pragma no branch assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] - self._login = attributes["login"] + self._login = github.GithubObject.ValuedAttribute(attributes["login"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "organizations_url" in attributes: # pragma no branch assert attributes["organizations_url"] is None or isinstance(attributes["organizations_url"], (str, unicode)), attributes["organizations_url"] - self._organizations_url = attributes["organizations_url"] + self._organizations_url = github.GithubObject.ValuedAttribute(attributes["organizations_url"]) if "owned_private_repos" in attributes: # pragma no branch assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] - self._owned_private_repos = attributes["owned_private_repos"] + self._owned_private_repos = github.GithubObject.ValuedAttribute(attributes["owned_private_repos"]) if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False) + self._plan = github.GithubObject.ValuedAttribute(None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] - self._private_gists = attributes["private_gists"] + self._private_gists = github.GithubObject.ValuedAttribute(attributes["private_gists"]) if "public_gists" in attributes: # pragma no branch assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] - self._public_gists = attributes["public_gists"] + self._public_gists = github.GithubObject.ValuedAttribute(attributes["public_gists"]) if "public_repos" in attributes: # pragma no branch assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] - self._public_repos = attributes["public_repos"] + self._public_repos = github.GithubObject.ValuedAttribute(attributes["public_repos"]) if "received_events_url" in attributes: # pragma no branch assert attributes["received_events_url"] is None or isinstance(attributes["received_events_url"], (str, unicode)), attributes["received_events_url"] - self._received_events_url = attributes["received_events_url"] + self._received_events_url = github.GithubObject.ValuedAttribute(attributes["received_events_url"]) if "repos_url" in attributes: # pragma no branch assert attributes["repos_url"] is None or isinstance(attributes["repos_url"], (str, unicode)), attributes["repos_url"] - self._repos_url = attributes["repos_url"] + self._repos_url = github.GithubObject.ValuedAttribute(attributes["repos_url"]) if "starred_url" in attributes: # pragma no branch assert attributes["starred_url"] is None or isinstance(attributes["starred_url"], (str, unicode)), attributes["starred_url"] - self._starred_url = attributes["starred_url"] + self._starred_url = github.GithubObject.ValuedAttribute(attributes["starred_url"]) if "subscriptions_url" in attributes: # pragma no branch assert attributes["subscriptions_url"] is None or isinstance(attributes["subscriptions_url"], (str, unicode)), attributes["subscriptions_url"] - self._subscriptions_url = attributes["subscriptions_url"] + self._subscriptions_url = github.GithubObject.ValuedAttribute(attributes["subscriptions_url"]) if "total_private_repos" in attributes: # pragma no branch assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] - self._total_private_repos = attributes["total_private_repos"] + self._total_private_repos = github.GithubObject.ValuedAttribute(attributes["total_private_repos"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) 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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Notification.py b/github/Notification.py index 3055ae86..7f100840 100644 --- a/github/Notification.py +++ b/github/Notification.py @@ -41,7 +41,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def last_read_at(self): @@ -49,7 +49,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._last_read_at) - return self._NoneIfNotSet(self._last_read_at) + return self._last_read_at.value @property def repository(self): @@ -57,7 +57,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: :class:`github.Repository.Repository` """ self._completeIfNotSet(self._repository) - return self._NoneIfNotSet(self._repository) + return self._repository.value @property def subject(self): @@ -65,7 +65,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: :class:`github.NotificationSubject.NotificationSubject` """ self._completeIfNotSet(self._subject) - return self._NoneIfNotSet(self._subject) + return self._subject.value @property def reason(self): @@ -73,7 +73,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._reason) - return self._NoneIfNotSet(self._reason) + return self._reason.value @property def subscription_url(self): @@ -81,7 +81,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._subscription_url) - return self._NoneIfNotSet(self._subscription_url) + return self._subscription_url.value @property def unread(self): @@ -89,7 +89,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._unread) - return self._NoneIfNotSet(self._unread) + return self._unread.value @property def updated_at(self): @@ -97,7 +97,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -105,7 +105,7 @@ class Notification(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def _initAttributes(self): self._id = github.GithubObject.NotSet @@ -120,28 +120,28 @@ class Notification(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (str, unicode)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "last_read_at" in attributes: # pragma no branch assert attributes["last_read_at"] is None or isinstance(attributes["last_read_at"], (str, unicode)), attributes["last_read_at"] - self._last_read_at = self._parseDatetime(attributes["last_read_at"]) + self._last_read_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["last_read_at"])) 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 github.Repository.Repository(self._requester, self._headers, attributes["repository"], completed=False) + self._repository = github.GithubObject.ValuedAttribute(None if attributes["repository"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repository"], completed=False)) if "subject" in attributes: # pragma no branch assert attributes["subject"] is None or isinstance(attributes["subject"], dict), attributes["subject"] - self._subject = None if attributes["subject"] is None else github.NotificationSubject.NotificationSubject(self._requester, self._headers, attributes["subject"], completed=False) + self._subject = github.GithubObject.ValuedAttribute(None if attributes["subject"] is None else github.NotificationSubject.NotificationSubject(self._requester, self._headers, attributes["subject"], completed=False)) if "reason" in attributes: # pragma no branch assert attributes["reason"] is None or isinstance(attributes["reason"], (str, unicode)), attributes["reason"] - self._reason = attributes["reason"] + self._reason = github.GithubObject.ValuedAttribute(attributes["reason"]) if "subscription_url" in attributes: # pragma no branch assert attributes["subscription_url"] is None or isinstance(attributes["subscription_url"], (str, unicode)), attributes["subscription_url"] - self._subscription_url = attributes["subscription_url"] + self._subscription_url = github.GithubObject.ValuedAttribute(attributes["subscription_url"]) if "unread" in attributes: # pragma no branch assert attributes["unread"] is None or isinstance(attributes["unread"], bool), attributes["unread"] - self._unread = attributes["unread"] + self._unread = github.GithubObject.ValuedAttribute(attributes["unread"]) 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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] # pragma no cover (but should be investigated) - self._url = attributes["url"] # pragma no cover (but should be investigated) + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/NotificationSubject.py b/github/NotificationSubject.py index 7e1ce3ad..bb9f7d5c 100644 --- a/github/NotificationSubject.py +++ b/github/NotificationSubject.py @@ -35,28 +35,28 @@ class NotificationSubject(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._title) + return self._title.value @property def url(self): """ :type: string """ - return self._NoneIfNotSet(self._url) + return self._url.value @property def latest_comment_url(self): """ :type: string """ - return self._NoneIfNotSet(self._latest_comment_url) + return self._latest_comment_url.value @property def type(self): """ :type: string """ - return self._NoneIfNotSet(self._type) + return self._type.value def _initAttributes(self): self._title = github.GithubObject.NotSet @@ -67,13 +67,13 @@ class NotificationSubject(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] - self._title = attributes["title"] + self._title = github.GithubObject.ValuedAttribute(attributes["title"]) if "url" in attributes: # pragma no branch - assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] # pragma no cover (but should be investigated) - self._url = attributes["url"] # pragma no cover (but should be investigated) + assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) if "latest_comment_url" in attributes: # pragma no branch - assert attributes["latest_comment_url"] is None or isinstance(attributes["latest_comment_url"], (str, unicode)), attributes["latest_comment_url"] # pragma no cover (but should be investigated) - self._latest_comment_url = attributes["latest_comment_url"] # pragma no cover (but should be investigated) + assert attributes["latest_comment_url"] is None or isinstance(attributes["latest_comment_url"], (str, unicode)), attributes["latest_comment_url"] + self._latest_comment_url = github.GithubObject.ValuedAttribute(attributes["latest_comment_url"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) diff --git a/github/Organization.py b/github/Organization.py index 3628bbf0..c23ec55e 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -49,7 +49,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._avatar_url) - return self._NoneIfNotSet(self._avatar_url) + return self._avatar_url.value @property def billing_email(self): @@ -57,7 +57,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._billing_email) - return self._NoneIfNotSet(self._billing_email) + return self._billing_email.value @property def blog(self): @@ -65,7 +65,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._blog) - return self._NoneIfNotSet(self._blog) + return self._blog.value @property def collaborators(self): @@ -73,7 +73,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._collaborators) - return self._NoneIfNotSet(self._collaborators) + return self._collaborators.value @property def company(self): @@ -81,7 +81,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._company) - return self._NoneIfNotSet(self._company) + return self._company.value @property def created_at(self): @@ -89,7 +89,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def disk_usage(self): @@ -97,7 +97,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._disk_usage) - return self._NoneIfNotSet(self._disk_usage) + return self._disk_usage.value @property def email(self): @@ -105,7 +105,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._email) - return self._NoneIfNotSet(self._email) + return self._email.value @property def events_url(self): @@ -113,7 +113,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._events_url) - return self._NoneIfNotSet(self._events_url) + return self._events_url.value @property def followers(self): @@ -121,7 +121,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._followers) - return self._NoneIfNotSet(self._followers) + return self._followers.value @property def following(self): @@ -129,7 +129,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._following) - return self._NoneIfNotSet(self._following) + return self._following.value @property def gravatar_id(self): @@ -137,7 +137,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._gravatar_id) - return self._NoneIfNotSet(self._gravatar_id) + return self._gravatar_id.value @property def html_url(self): @@ -145,7 +145,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -153,7 +153,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def location(self): @@ -161,7 +161,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._location) - return self._NoneIfNotSet(self._location) + return self._location.value @property def login(self): @@ -169,7 +169,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._login) - return self._NoneIfNotSet(self._login) + return self._login.value @property def members_url(self): @@ -177,7 +177,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._members_url) - return self._NoneIfNotSet(self._members_url) + return self._members_url.value @property def name(self): @@ -185,7 +185,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def owned_private_repos(self): @@ -193,7 +193,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._owned_private_repos) - return self._NoneIfNotSet(self._owned_private_repos) + return self._owned_private_repos.value @property def plan(self): @@ -201,7 +201,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: :class:`github.Plan.Plan` """ self._completeIfNotSet(self._plan) - return self._NoneIfNotSet(self._plan) + return self._plan.value @property def private_gists(self): @@ -209,7 +209,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._private_gists) - return self._NoneIfNotSet(self._private_gists) + return self._private_gists.value @property def public_gists(self): @@ -217,7 +217,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_gists) - return self._NoneIfNotSet(self._public_gists) + return self._public_gists.value @property def public_members_url(self): @@ -225,7 +225,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._public_members_url) - return self._NoneIfNotSet(self._public_members_url) + return self._public_members_url.value @property def public_repos(self): @@ -233,7 +233,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._public_repos) - return self._NoneIfNotSet(self._public_repos) + return self._public_repos.value @property def repos_url(self): @@ -241,7 +241,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._repos_url) - return self._NoneIfNotSet(self._repos_url) + return self._repos_url.value @property def total_private_repos(self): @@ -249,7 +249,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._total_private_repos) - return self._NoneIfNotSet(self._total_private_repos) + return self._total_private_repos.value @property def type(self): @@ -257,7 +257,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._type) - return self._NoneIfNotSet(self._type) + return self._type.value @property def updated_at(self): @@ -265,7 +265,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -273,7 +273,7 @@ class Organization(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def add_to_public_members(self, public_member): """ @@ -632,88 +632,88 @@ class Organization(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "avatar_url" in attributes: # pragma no branch assert attributes["avatar_url"] is None or isinstance(attributes["avatar_url"], (str, unicode)), attributes["avatar_url"] - self._avatar_url = attributes["avatar_url"] + self._avatar_url = github.GithubObject.ValuedAttribute(attributes["avatar_url"]) if "billing_email" in attributes: # pragma no branch assert attributes["billing_email"] is None or isinstance(attributes["billing_email"], (str, unicode)), attributes["billing_email"] - self._billing_email = attributes["billing_email"] + self._billing_email = github.GithubObject.ValuedAttribute(attributes["billing_email"]) if "blog" in attributes: # pragma no branch assert attributes["blog"] is None or isinstance(attributes["blog"], (str, unicode)), attributes["blog"] - self._blog = attributes["blog"] + self._blog = github.GithubObject.ValuedAttribute(attributes["blog"]) if "collaborators" in attributes: # pragma no branch assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] - self._collaborators = attributes["collaborators"] + self._collaborators = github.GithubObject.ValuedAttribute(attributes["collaborators"]) if "company" in attributes: # pragma no branch assert attributes["company"] is None or isinstance(attributes["company"], (str, unicode)), attributes["company"] - self._company = attributes["company"] + self._company = github.GithubObject.ValuedAttribute(attributes["company"]) 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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "disk_usage" in attributes: # pragma no branch assert attributes["disk_usage"] is None or isinstance(attributes["disk_usage"], (int, long)), attributes["disk_usage"] - self._disk_usage = attributes["disk_usage"] + self._disk_usage = github.GithubObject.ValuedAttribute(attributes["disk_usage"]) if "email" in attributes: # pragma no branch assert attributes["email"] is None or isinstance(attributes["email"], (str, unicode)), attributes["email"] - self._email = attributes["email"] + self._email = github.GithubObject.ValuedAttribute(attributes["email"]) if "events_url" in attributes: # pragma no branch assert attributes["events_url"] is None or isinstance(attributes["events_url"], (str, unicode)), attributes["events_url"] - self._events_url = attributes["events_url"] + self._events_url = github.GithubObject.ValuedAttribute(attributes["events_url"]) if "followers" in attributes: # pragma no branch assert attributes["followers"] is None or isinstance(attributes["followers"], (int, long)), attributes["followers"] - self._followers = attributes["followers"] + self._followers = github.GithubObject.ValuedAttribute(attributes["followers"]) if "following" in attributes: # pragma no branch assert attributes["following"] is None or isinstance(attributes["following"], (int, long)), attributes["following"] - self._following = attributes["following"] + self._following = github.GithubObject.ValuedAttribute(attributes["following"]) if "gravatar_id" in attributes: # pragma no branch assert attributes["gravatar_id"] is None or isinstance(attributes["gravatar_id"], (str, unicode)), attributes["gravatar_id"] - self._gravatar_id = attributes["gravatar_id"] + self._gravatar_id = github.GithubObject.ValuedAttribute(attributes["gravatar_id"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "location" in attributes: # pragma no branch assert attributes["location"] is None or isinstance(attributes["location"], (str, unicode)), attributes["location"] - self._location = attributes["location"] + self._location = github.GithubObject.ValuedAttribute(attributes["location"]) if "login" in attributes: # pragma no branch assert attributes["login"] is None or isinstance(attributes["login"], (str, unicode)), attributes["login"] - self._login = attributes["login"] + self._login = github.GithubObject.ValuedAttribute(attributes["login"]) if "members_url" in attributes: # pragma no branch assert attributes["members_url"] is None or isinstance(attributes["members_url"], (str, unicode)), attributes["members_url"] - self._members_url = attributes["members_url"] + self._members_url = github.GithubObject.ValuedAttribute(attributes["members_url"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "owned_private_repos" in attributes: # pragma no branch assert attributes["owned_private_repos"] is None or isinstance(attributes["owned_private_repos"], (int, long)), attributes["owned_private_repos"] - self._owned_private_repos = attributes["owned_private_repos"] + self._owned_private_repos = github.GithubObject.ValuedAttribute(attributes["owned_private_repos"]) if "plan" in attributes: # pragma no branch assert attributes["plan"] is None or isinstance(attributes["plan"], dict), attributes["plan"] - self._plan = None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False) + self._plan = github.GithubObject.ValuedAttribute(None if attributes["plan"] is None else github.Plan.Plan(self._requester, self._headers, attributes["plan"], completed=False)) if "private_gists" in attributes: # pragma no branch assert attributes["private_gists"] is None or isinstance(attributes["private_gists"], (int, long)), attributes["private_gists"] - self._private_gists = attributes["private_gists"] + self._private_gists = github.GithubObject.ValuedAttribute(attributes["private_gists"]) if "public_gists" in attributes: # pragma no branch assert attributes["public_gists"] is None or isinstance(attributes["public_gists"], (int, long)), attributes["public_gists"] - self._public_gists = attributes["public_gists"] + self._public_gists = github.GithubObject.ValuedAttribute(attributes["public_gists"]) if "public_members_url" in attributes: # pragma no branch assert attributes["public_members_url"] is None or isinstance(attributes["public_members_url"], (str, unicode)), attributes["public_members_url"] - self._public_members_url = attributes["public_members_url"] + self._public_members_url = github.GithubObject.ValuedAttribute(attributes["public_members_url"]) if "public_repos" in attributes: # pragma no branch assert attributes["public_repos"] is None or isinstance(attributes["public_repos"], (int, long)), attributes["public_repos"] - self._public_repos = attributes["public_repos"] + self._public_repos = github.GithubObject.ValuedAttribute(attributes["public_repos"]) if "repos_url" in attributes: # pragma no branch assert attributes["repos_url"] is None or isinstance(attributes["repos_url"], (str, unicode)), attributes["repos_url"] - self._repos_url = attributes["repos_url"] + self._repos_url = github.GithubObject.ValuedAttribute(attributes["repos_url"]) if "total_private_repos" in attributes: # pragma no branch assert attributes["total_private_repos"] is None or isinstance(attributes["total_private_repos"], (int, long)), attributes["total_private_repos"] - self._total_private_repos = attributes["total_private_repos"] + self._total_private_repos = github.GithubObject.ValuedAttribute(attributes["total_private_repos"]) if "type" in attributes: # pragma no branch assert attributes["type"] is None or isinstance(attributes["type"], (str, unicode)), attributes["type"] - self._type = attributes["type"] + self._type = github.GithubObject.ValuedAttribute(attributes["type"]) 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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/Permissions.py b/github/Permissions.py index 3a3b4206..68016a15 100644 --- a/github/Permissions.py +++ b/github/Permissions.py @@ -37,21 +37,21 @@ class Permissions(github.GithubObject.NonCompletableGithubObject): """ :type: bool """ - return self._NoneIfNotSet(self._admin) + return self._admin.value @property def pull(self): """ :type: bool """ - return self._NoneIfNotSet(self._pull) + return self._pull.value @property def push(self): """ :type: bool """ - return self._NoneIfNotSet(self._push) + return self._push.value def _initAttributes(self): self._admin = github.GithubObject.NotSet @@ -61,10 +61,10 @@ class Permissions(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "admin" in attributes: # pragma no branch assert attributes["admin"] is None or isinstance(attributes["admin"], bool), attributes["admin"] - self._admin = attributes["admin"] + self._admin = github.GithubObject.ValuedAttribute(attributes["admin"]) if "pull" in attributes: # pragma no branch assert attributes["pull"] is None or isinstance(attributes["pull"], bool), attributes["pull"] - self._pull = attributes["pull"] + self._pull = github.GithubObject.ValuedAttribute(attributes["pull"]) if "push" in attributes: # pragma no branch assert attributes["push"] is None or isinstance(attributes["push"], bool), attributes["push"] - self._push = attributes["push"] + self._push = github.GithubObject.ValuedAttribute(attributes["push"]) diff --git a/github/Plan.py b/github/Plan.py index 99a3c3a6..2a6d83f4 100644 --- a/github/Plan.py +++ b/github/Plan.py @@ -37,28 +37,28 @@ class Plan(github.GithubObject.NonCompletableGithubObject): """ :type: integer """ - return self._NoneIfNotSet(self._collaborators) + return self._collaborators.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value @property def private_repos(self): """ :type: integer """ - return self._NoneIfNotSet(self._private_repos) + return self._private_repos.value @property def space(self): """ :type: integer """ - return self._NoneIfNotSet(self._space) + return self._space.value def _initAttributes(self): self._collaborators = github.GithubObject.NotSet @@ -69,13 +69,13 @@ class Plan(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "collaborators" in attributes: # pragma no branch assert attributes["collaborators"] is None or isinstance(attributes["collaborators"], (int, long)), attributes["collaborators"] - self._collaborators = attributes["collaborators"] + self._collaborators = github.GithubObject.ValuedAttribute(attributes["collaborators"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "private_repos" in attributes: # pragma no branch assert attributes["private_repos"] is None or isinstance(attributes["private_repos"], (int, long)), attributes["private_repos"] - self._private_repos = attributes["private_repos"] + self._private_repos = github.GithubObject.ValuedAttribute(attributes["private_repos"]) if "space" in attributes: # pragma no branch assert attributes["space"] is None or isinstance(attributes["space"], (int, long)), attributes["space"] - self._space = attributes["space"] + self._space = github.GithubObject.ValuedAttribute(attributes["space"]) diff --git a/github/PullRequest.py b/github/PullRequest.py index a1e4f13f..06214044 100644 --- a/github/PullRequest.py +++ b/github/PullRequest.py @@ -49,7 +49,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._additions) - return self._NoneIfNotSet(self._additions) + return self._additions.value @property def assignee(self): @@ -57,7 +57,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._assignee) - return self._NoneIfNotSet(self._assignee) + return self._assignee.value @property def base(self): @@ -65,7 +65,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.PullRequestPart.PullRequestPart` """ self._completeIfNotSet(self._base) - return self._NoneIfNotSet(self._base) + return self._base.value @property def body(self): @@ -73,7 +73,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def changed_files(self): @@ -81,7 +81,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._changed_files) - return self._NoneIfNotSet(self._changed_files) + return self._changed_files.value @property def closed_at(self): @@ -89,7 +89,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._closed_at) - return self._NoneIfNotSet(self._closed_at) + return self._closed_at.value @property def comments(self): @@ -97,7 +97,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._comments) - return self._NoneIfNotSet(self._comments) + return self._comments.value @property def comments_url(self): @@ -105,7 +105,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def commits(self): @@ -113,7 +113,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._commits) - return self._NoneIfNotSet(self._commits) + return self._commits.value @property def commits_url(self): @@ -121,7 +121,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commits_url) - return self._NoneIfNotSet(self._commits_url) + return self._commits_url.value @property def created_at(self): @@ -129,7 +129,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def deletions(self): @@ -137,7 +137,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._deletions) - return self._NoneIfNotSet(self._deletions) + return self._deletions.value @property def diff_url(self): @@ -145,7 +145,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._diff_url) - return self._NoneIfNotSet(self._diff_url) + return self._diff_url.value @property def head(self): @@ -153,7 +153,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.PullRequestPart.PullRequestPart` """ self._completeIfNotSet(self._head) - return self._NoneIfNotSet(self._head) + return self._head.value @property def html_url(self): @@ -161,7 +161,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -169,7 +169,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def issue_url(self): @@ -177,7 +177,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._issue_url) - return self._NoneIfNotSet(self._issue_url) + return self._issue_url.value @property def merge_commit_sha(self): @@ -185,7 +185,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._merge_commit_sha) - return self._NoneIfNotSet(self._merge_commit_sha) + return self._merge_commit_sha.value @property def mergeable(self): @@ -193,7 +193,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._mergeable) - return self._NoneIfNotSet(self._mergeable) + return self._mergeable.value @property def mergeable_state(self): @@ -201,7 +201,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._mergeable_state) - return self._NoneIfNotSet(self._mergeable_state) + return self._mergeable_state.value @property def merged(self): @@ -209,7 +209,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._merged) - return self._NoneIfNotSet(self._merged) + return self._merged.value @property def merged_at(self): @@ -217,7 +217,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._merged_at) - return self._NoneIfNotSet(self._merged_at) + return self._merged_at.value @property def merged_by(self): @@ -225,7 +225,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._merged_by) - return self._NoneIfNotSet(self._merged_by) + return self._merged_by.value @property def milestone(self): @@ -233,7 +233,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.Milestone.Milestone` """ self._completeIfNotSet(self._milestone) - return self._NoneIfNotSet(self._milestone) + return self._milestone.value @property def number(self): @@ -241,7 +241,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._number) - return self._NoneIfNotSet(self._number) + return self._number.value @property def patch_url(self): @@ -249,7 +249,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._patch_url) - return self._NoneIfNotSet(self._patch_url) + return self._patch_url.value @property def review_comment_url(self): @@ -257,7 +257,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._review_comment_url) - return self._NoneIfNotSet(self._review_comment_url) + return self._review_comment_url.value @property def review_comments(self): @@ -265,7 +265,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._review_comments) - return self._NoneIfNotSet(self._review_comments) + return self._review_comments.value @property def review_comments_url(self): @@ -273,7 +273,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._review_comments_url) - return self._NoneIfNotSet(self._review_comments_url) + return self._review_comments_url.value @property def state(self): @@ -281,7 +281,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._state) - return self._NoneIfNotSet(self._state) + return self._state.value @property def title(self): @@ -289,7 +289,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._title) - return self._NoneIfNotSet(self._title) + return self._title.value @property def updated_at(self): @@ -297,7 +297,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -305,7 +305,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def user(self): @@ -313,7 +313,7 @@ class PullRequest(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def create_comment(self, body, commit_id, path, position): """ @@ -550,103 +550,103 @@ class PullRequest(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "additions" in attributes: # pragma no branch assert attributes["additions"] is None or isinstance(attributes["additions"], (int, long)), attributes["additions"] - self._additions = attributes["additions"] + self._additions = github.GithubObject.ValuedAttribute(attributes["additions"]) 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["assignee"], completed=False) + self._assignee = github.GithubObject.ValuedAttribute(None if attributes["assignee"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["assignee"], completed=False)) 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 github.PullRequestPart.PullRequestPart(self._requester, self._headers, attributes["base"], completed=False) + self._base = github.GithubObject.ValuedAttribute(None if attributes["base"] is None else github.PullRequestPart.PullRequestPart(self._requester, self._headers, 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"] + self._body = github.GithubObject.ValuedAttribute(attributes["body"]) if "changed_files" in attributes: # pragma no branch assert attributes["changed_files"] is None or isinstance(attributes["changed_files"], (int, long)), attributes["changed_files"] - self._changed_files = attributes["changed_files"] + self._changed_files = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["closed_at"]) + self._closed_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["closed_at"])) if "comments" in attributes: # pragma no branch assert attributes["comments"] is None or isinstance(attributes["comments"], (int, long)), attributes["comments"] - self._comments = attributes["comments"] + self._comments = github.GithubObject.ValuedAttribute(attributes["comments"]) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_url"]) if "commits" in attributes: # pragma no branch assert attributes["commits"] is None or isinstance(attributes["commits"], (int, long)), attributes["commits"] - self._commits = attributes["commits"] + self._commits = github.GithubObject.ValuedAttribute(attributes["commits"]) if "commits_url" in attributes: # pragma no branch assert attributes["commits_url"] is None or isinstance(attributes["commits_url"], (str, unicode)), attributes["commits_url"] - self._commits_url = attributes["commits_url"] + self._commits_url = github.GithubObject.ValuedAttribute(attributes["commits_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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "deletions" in attributes: # pragma no branch assert attributes["deletions"] is None or isinstance(attributes["deletions"], (int, long)), attributes["deletions"] - self._deletions = attributes["deletions"] + self._deletions = github.GithubObject.ValuedAttribute(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"] + self._diff_url = github.GithubObject.ValuedAttribute(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 github.PullRequestPart.PullRequestPart(self._requester, self._headers, attributes["head"], completed=False) + self._head = github.GithubObject.ValuedAttribute(None if attributes["head"] is None else github.PullRequestPart.PullRequestPart(self._requester, self._headers, 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._issue_url = github.GithubObject.ValuedAttribute(attributes["issue_url"]) if "merge_commit_sha" in attributes: # pragma no branch assert attributes["merge_commit_sha"] is None or isinstance(attributes["merge_commit_sha"], (str, unicode)), attributes["merge_commit_sha"] - self._merge_commit_sha = attributes["merge_commit_sha"] + self._merge_commit_sha = github.GithubObject.ValuedAttribute(attributes["merge_commit_sha"]) if "mergeable" in attributes: # pragma no branch assert attributes["mergeable"] is None or isinstance(attributes["mergeable"], bool), attributes["mergeable"] - self._mergeable = attributes["mergeable"] + self._mergeable = github.GithubObject.ValuedAttribute(attributes["mergeable"]) if "mergeable_state" in attributes: # pragma no branch assert attributes["mergeable_state"] is None or isinstance(attributes["mergeable_state"], (str, unicode)), attributes["mergeable_state"] - self._mergeable_state = attributes["mergeable_state"] + self._mergeable_state = github.GithubObject.ValuedAttribute(attributes["mergeable_state"]) if "merged" in attributes: # pragma no branch assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"] - self._merged = attributes["merged"] + self._merged = github.GithubObject.ValuedAttribute(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 = self._parseDatetime(attributes["merged_at"]) + self._merged_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["merged_at"])) 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["merged_by"], completed=False) + self._merged_by = github.GithubObject.ValuedAttribute(None if attributes["merged_by"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["merged_by"], completed=False)) 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 github.Milestone.Milestone(self._requester, self._headers, attributes["milestone"], completed=False) + self._milestone = github.GithubObject.ValuedAttribute(None if attributes["milestone"] is None else github.Milestone.Milestone(self._requester, self._headers, 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"] + self._number = github.GithubObject.ValuedAttribute(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"] + self._patch_url = github.GithubObject.ValuedAttribute(attributes["patch_url"]) if "review_comment_url" in attributes: # pragma no branch assert attributes["review_comment_url"] is None or isinstance(attributes["review_comment_url"], (str, unicode)), attributes["review_comment_url"] - self._review_comment_url = attributes["review_comment_url"] + self._review_comment_url = github.GithubObject.ValuedAttribute(attributes["review_comment_url"]) if "review_comments" in attributes: # pragma no branch assert attributes["review_comments"] is None or isinstance(attributes["review_comments"], (int, long)), attributes["review_comments"] - self._review_comments = attributes["review_comments"] + self._review_comments = github.GithubObject.ValuedAttribute(attributes["review_comments"]) if "review_comments_url" in attributes: # pragma no branch assert attributes["review_comments_url"] is None or isinstance(attributes["review_comments_url"], (str, unicode)), attributes["review_comments_url"] - self._review_comments_url = attributes["review_comments_url"] + self._review_comments_url = github.GithubObject.ValuedAttribute(attributes["review_comments_url"]) if "state" in attributes: # pragma no branch assert attributes["state"] is None or isinstance(attributes["state"], (str, unicode)), attributes["state"] - self._state = attributes["state"] + self._state = github.GithubObject.ValuedAttribute(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"] + self._title = github.GithubObject.ValuedAttribute(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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/PullRequestComment.py b/github/PullRequestComment.py index 5ebd95dd..b8f1e018 100644 --- a/github/PullRequestComment.py +++ b/github/PullRequestComment.py @@ -42,7 +42,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._body) - return self._NoneIfNotSet(self._body) + return self._body.value @property def commit_id(self): @@ -50,7 +50,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commit_id) - return self._NoneIfNotSet(self._commit_id) + return self._commit_id.value @property def created_at(self): @@ -58,7 +58,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def diff_hunk(self): @@ -66,7 +66,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._diff_hunk) - return self._NoneIfNotSet(self._diff_hunk) + return self._diff_hunk.value @property def id(self): @@ -74,7 +74,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def original_commit_id(self): @@ -82,7 +82,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._original_commit_id) - return self._NoneIfNotSet(self._original_commit_id) + return self._original_commit_id.value @property def original_position(self): @@ -90,7 +90,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._original_position) - return self._NoneIfNotSet(self._original_position) + return self._original_position.value @property def path(self): @@ -98,7 +98,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._path) - return self._NoneIfNotSet(self._path) + return self._path.value @property def position(self): @@ -106,7 +106,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._position) - return self._NoneIfNotSet(self._position) + return self._position.value @property def pull_request_url(self): @@ -114,7 +114,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._pull_request_url) - return self._NoneIfNotSet(self._pull_request_url) + return self._pull_request_url.value @property def updated_at(self): @@ -122,7 +122,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -130,7 +130,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def html_url(self): @@ -138,7 +138,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def user(self): @@ -146,7 +146,7 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._user) - return self._NoneIfNotSet(self._user) + return self._user.value def delete(self): """ @@ -194,43 +194,43 @@ class PullRequestComment(github.GithubObject.CompletableGithubObject): 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"] + self._body = github.GithubObject.ValuedAttribute(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"] + self._commit_id = github.GithubObject.ValuedAttribute(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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "diff_hunk" in attributes: # pragma no branch assert attributes["diff_hunk"] is None or isinstance(attributes["diff_hunk"], (str, unicode)), attributes["diff_hunk"] - self._diff_hunk = attributes["diff_hunk"] + self._diff_hunk = github.GithubObject.ValuedAttribute(attributes["diff_hunk"]) if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(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"] + self._original_commit_id = github.GithubObject.ValuedAttribute(attributes["original_commit_id"]) if "original_position" in attributes: # pragma no branch assert attributes["original_position"] is None or isinstance(attributes["original_position"], (int, long)), attributes["original_position"] - self._original_position = attributes["original_position"] + self._original_position = github.GithubObject.ValuedAttribute(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"] + self._path = github.GithubObject.ValuedAttribute(attributes["path"]) if "position" in attributes: # pragma no branch assert attributes["position"] is None or isinstance(attributes["position"], (int, long)), attributes["position"] - self._position = attributes["position"] + self._position = github.GithubObject.ValuedAttribute(attributes["position"]) if "pull_request_url" in attributes: # pragma no branch assert attributes["pull_request_url"] is None or isinstance(attributes["pull_request_url"], (str, unicode)), attributes["pull_request_url"] - self._pull_request_url = attributes["pull_request_url"] + self._pull_request_url = github.GithubObject.ValuedAttribute(attributes["pull_request_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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(attributes["html_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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/PullRequestMergeStatus.py b/github/PullRequestMergeStatus.py index 9c416dbd..4f1cef0a 100644 --- a/github/PullRequestMergeStatus.py +++ b/github/PullRequestMergeStatus.py @@ -38,21 +38,21 @@ class PullRequestMergeStatus(github.GithubObject.NonCompletableGithubObject): """ :type: bool """ - return self._NoneIfNotSet(self._merged) + return self._merged.value @property def message(self): """ :type: string """ - return self._NoneIfNotSet(self._message) + return self._message.value @property def sha(self): """ :type: string """ - return self._NoneIfNotSet(self._sha) + return self._sha.value def _initAttributes(self): self._merged = github.GithubObject.NotSet @@ -62,10 +62,10 @@ class PullRequestMergeStatus(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "merged" in attributes: # pragma no branch assert attributes["merged"] is None or isinstance(attributes["merged"], bool), attributes["merged"] - self._merged = attributes["merged"] + self._merged = github.GithubObject.ValuedAttribute(attributes["merged"]) if "message" in attributes: # pragma no branch assert attributes["message"] is None or isinstance(attributes["message"], (str, unicode)), attributes["message"] - self._message = attributes["message"] + self._message = github.GithubObject.ValuedAttribute(attributes["message"]) if "sha" in attributes: # pragma no branch assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"] - self._sha = attributes["sha"] + self._sha = github.GithubObject.ValuedAttribute(attributes["sha"]) diff --git a/github/PullRequestPart.py b/github/PullRequestPart.py index 791452b0..754bcb09 100644 --- a/github/PullRequestPart.py +++ b/github/PullRequestPart.py @@ -40,35 +40,35 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._label) + return self._label.value @property def ref(self): """ :type: string """ - return self._NoneIfNotSet(self._ref) + return self._ref.value @property def repo(self): """ :type: :class:`github.Repository.Repository` """ - return self._NoneIfNotSet(self._repo) + return self._repo.value @property def sha(self): """ :type: string """ - return self._NoneIfNotSet(self._sha) + return self._sha.value @property def user(self): """ :type: :class:`github.NamedUser.NamedUser` """ - return self._NoneIfNotSet(self._user) + return self._user.value def _initAttributes(self): self._label = github.GithubObject.NotSet @@ -80,16 +80,16 @@ 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 = attributes["label"] + self._label = github.GithubObject.ValuedAttribute(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"] + self._ref = github.GithubObject.ValuedAttribute(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 github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False) + self._repo = github.GithubObject.ValuedAttribute(None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, 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"] + self._sha = github.GithubObject.ValuedAttribute(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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False) + self._user = github.GithubObject.ValuedAttribute(None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)) diff --git a/github/Rate.py b/github/Rate.py index aad4ef3f..eb4592e8 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -35,21 +35,21 @@ class Rate(github.GithubObject.NonCompletableGithubObject): """ :type: integer """ - return self._NoneIfNotSet(self._limit) + return self._limit.value @property def remaining(self): """ :type: integer """ - return self._NoneIfNotSet(self._remaining) + return self._remaining.value @property def reset(self): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._reset) + return self._reset.value def _initAttributes(self): self._limit = github.GithubObject.NotSet @@ -59,10 +59,10 @@ class Rate(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "limit" in attributes: # pragma no branch assert attributes["limit"] is None or isinstance(attributes["limit"], (int, long)), attributes["limit"] - self._limit = attributes["limit"] + self._limit = github.GithubObject.ValuedAttribute(attributes["limit"]) if "remaining" in attributes: # pragma no branch assert attributes["remaining"] is None or isinstance(attributes["remaining"], (int, long)), attributes["remaining"] - self._remaining = attributes["remaining"] + self._remaining = github.GithubObject.ValuedAttribute(attributes["remaining"]) if "reset" in attributes: # pragma no branch assert attributes["reset"] is None or isinstance(attributes["reset"], (int, long)), attributes["reset"] - self._reset = datetime.datetime.utcfromtimestamp(attributes["reset"]) + self._reset = github.GithubObject.ValuedAttribute(datetime.datetime.utcfromtimestamp(attributes["reset"])) diff --git a/github/RateLimit.py b/github/RateLimit.py index 38589049..39b2d860 100644 --- a/github/RateLimit.py +++ b/github/RateLimit.py @@ -35,7 +35,7 @@ class RateLimit(github.GithubObject.NonCompletableGithubObject): """ :type: class:`github.Rate.Rate` """ - return self._NoneIfNotSet(self._rate) + return self._rate.value def _initAttributes(self): self._rate = github.GithubObject.NotSet @@ -43,4 +43,4 @@ class RateLimit(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "rate" in attributes: # pragma no branch assert attributes["rate"] is None or isinstance(attributes["rate"], dict), attributes["rate"] - self._rate = None if attributes["rate"] is None else github.Rate.Rate(self._requester, self._headers, attributes["rate"], completed=False) + self._rate = github.GithubObject.ValuedAttribute(None if attributes["rate"] is None else github.Rate.Rate(self._requester, self._headers, attributes["rate"], completed=False)) diff --git a/github/Repository.py b/github/Repository.py index 37d303bb..7541620d 100644 --- a/github/Repository.py +++ b/github/Repository.py @@ -74,7 +74,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._archive_url) - return self._NoneIfNotSet(self._archive_url) + return self._archive_url.value @property def assignees_url(self): @@ -82,7 +82,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._assignees_url) - return self._NoneIfNotSet(self._assignees_url) + return self._assignees_url.value @property def blobs_url(self): @@ -90,7 +90,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._blobs_url) - return self._NoneIfNotSet(self._blobs_url) + return self._blobs_url.value @property def branches_url(self): @@ -98,7 +98,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._branches_url) - return self._NoneIfNotSet(self._branches_url) + return self._branches_url.value @property def clone_url(self): @@ -106,7 +106,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._clone_url) - return self._NoneIfNotSet(self._clone_url) + return self._clone_url.value @property def collaborators_url(self): @@ -114,7 +114,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._collaborators_url) - return self._NoneIfNotSet(self._collaborators_url) + return self._collaborators_url.value @property def comments_url(self): @@ -122,7 +122,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._comments_url) - return self._NoneIfNotSet(self._comments_url) + return self._comments_url.value @property def commits_url(self): @@ -130,7 +130,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._commits_url) - return self._NoneIfNotSet(self._commits_url) + return self._commits_url.value @property def compare_url(self): @@ -138,7 +138,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._compare_url) - return self._NoneIfNotSet(self._compare_url) + return self._compare_url.value @property def contents_url(self): @@ -146,7 +146,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._contents_url) - return self._NoneIfNotSet(self._contents_url) + return self._contents_url.value @property def contributors_url(self): @@ -154,7 +154,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._contributors_url) - return self._NoneIfNotSet(self._contributors_url) + return self._contributors_url.value @property def created_at(self): @@ -162,7 +162,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._created_at) - return self._NoneIfNotSet(self._created_at) + return self._created_at.value @property def default_branch(self): @@ -170,7 +170,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._default_branch) - return self._NoneIfNotSet(self._default_branch) + return self._default_branch.value @property def description(self): @@ -178,7 +178,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._description) - return self._NoneIfNotSet(self._description) + return self._description.value @property def downloads_url(self): @@ -186,7 +186,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._downloads_url) - return self._NoneIfNotSet(self._downloads_url) + return self._downloads_url.value @property def events_url(self): @@ -194,7 +194,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._events_url) - return self._NoneIfNotSet(self._events_url) + return self._events_url.value @property def fork(self): @@ -202,7 +202,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._fork) - return self._NoneIfNotSet(self._fork) + return self._fork.value @property def forks(self): @@ -210,7 +210,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._forks) - return self._NoneIfNotSet(self._forks) + return self._forks.value @property def forks_count(self): @@ -218,7 +218,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._forks_count) - return self._NoneIfNotSet(self._forks_count) + return self._forks_count.value @property def forks_url(self): @@ -226,7 +226,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._forks_url) - return self._NoneIfNotSet(self._forks_url) + return self._forks_url.value @property def full_name(self): @@ -234,7 +234,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._full_name) - return self._NoneIfNotSet(self._full_name) + return self._full_name.value @property def git_commits_url(self): @@ -242,7 +242,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_commits_url) - return self._NoneIfNotSet(self._git_commits_url) + return self._git_commits_url.value @property def git_refs_url(self): @@ -250,7 +250,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_refs_url) - return self._NoneIfNotSet(self._git_refs_url) + return self._git_refs_url.value @property def git_tags_url(self): @@ -258,7 +258,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_tags_url) - return self._NoneIfNotSet(self._git_tags_url) + return self._git_tags_url.value @property def git_url(self): @@ -266,7 +266,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._git_url) - return self._NoneIfNotSet(self._git_url) + return self._git_url.value @property def has_downloads(self): @@ -274,7 +274,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._has_downloads) - return self._NoneIfNotSet(self._has_downloads) + return self._has_downloads.value @property def has_issues(self): @@ -282,7 +282,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._has_issues) - return self._NoneIfNotSet(self._has_issues) + return self._has_issues.value @property def has_wiki(self): @@ -290,7 +290,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._has_wiki) - return self._NoneIfNotSet(self._has_wiki) + return self._has_wiki.value @property def homepage(self): @@ -298,7 +298,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._homepage) - return self._NoneIfNotSet(self._homepage) + return self._homepage.value @property def hooks_url(self): @@ -306,7 +306,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._hooks_url) - return self._NoneIfNotSet(self._hooks_url) + return self._hooks_url.value @property def html_url(self): @@ -314,7 +314,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._html_url) - return self._NoneIfNotSet(self._html_url) + return self._html_url.value @property def id(self): @@ -322,7 +322,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def issue_comment_url(self): @@ -330,7 +330,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._issue_comment_url) - return self._NoneIfNotSet(self._issue_comment_url) + return self._issue_comment_url.value @property def issue_events_url(self): @@ -338,7 +338,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._issue_events_url) - return self._NoneIfNotSet(self._issue_events_url) + return self._issue_events_url.value @property def issues_url(self): @@ -346,7 +346,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._issues_url) - return self._NoneIfNotSet(self._issues_url) + return self._issues_url.value @property def keys_url(self): @@ -354,7 +354,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._keys_url) - return self._NoneIfNotSet(self._keys_url) + return self._keys_url.value @property def labels_url(self): @@ -362,7 +362,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._labels_url) - return self._NoneIfNotSet(self._labels_url) + return self._labels_url.value @property def language(self): @@ -370,7 +370,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._language) - return self._NoneIfNotSet(self._language) + return self._language.value @property def languages_url(self): @@ -378,7 +378,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._languages_url) - return self._NoneIfNotSet(self._languages_url) + return self._languages_url.value @property def master_branch(self): @@ -386,7 +386,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._master_branch) - return self._NoneIfNotSet(self._master_branch) + return self._master_branch.value @property def merges_url(self): @@ -394,7 +394,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._merges_url) - return self._NoneIfNotSet(self._merges_url) + return self._merges_url.value @property def milestones_url(self): @@ -402,7 +402,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._milestones_url) - return self._NoneIfNotSet(self._milestones_url) + return self._milestones_url.value @property def mirror_url(self): @@ -410,7 +410,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._mirror_url) - return self._NoneIfNotSet(self._mirror_url) + return self._mirror_url.value @property def name(self): @@ -418,7 +418,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def network_count(self): @@ -426,7 +426,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._network_count) - return self._NoneIfNotSet(self._network_count) + return self._network_count.value @property def notifications_url(self): @@ -434,7 +434,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._notifications_url) - return self._NoneIfNotSet(self._notifications_url) + return self._notifications_url.value @property def open_issues(self): @@ -442,7 +442,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._open_issues) - return self._NoneIfNotSet(self._open_issues) + return self._open_issues.value @property def open_issues_count(self): @@ -450,7 +450,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._open_issues_count) - return self._NoneIfNotSet(self._open_issues_count) + return self._open_issues_count.value @property def organization(self): @@ -458,7 +458,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: :class:`github.Organization.Organization` """ self._completeIfNotSet(self._organization) - return self._NoneIfNotSet(self._organization) + return self._organization.value @property def owner(self): @@ -466,7 +466,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._owner) - return self._NoneIfNotSet(self._owner) + return self._owner.value @property def parent(self): @@ -474,7 +474,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: :class:`github.Repository.Repository` """ self._completeIfNotSet(self._parent) - return self._NoneIfNotSet(self._parent) + return self._parent.value @property def permissions(self): @@ -482,7 +482,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: :class:`github.Permissions.Permissions` """ self._completeIfNotSet(self._permissions) - return self._NoneIfNotSet(self._permissions) + return self._permissions.value @property def private(self): @@ -490,7 +490,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._private) - return self._NoneIfNotSet(self._private) + return self._private.value @property def pulls_url(self): @@ -498,7 +498,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._pulls_url) - return self._NoneIfNotSet(self._pulls_url) + return self._pulls_url.value @property def pushed_at(self): @@ -506,7 +506,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._pushed_at) - return self._NoneIfNotSet(self._pushed_at) + return self._pushed_at.value @property def size(self): @@ -514,7 +514,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._size) - return self._NoneIfNotSet(self._size) + return self._size.value @property def source(self): @@ -522,7 +522,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: :class:`github.Repository.Repository` """ self._completeIfNotSet(self._source) - return self._NoneIfNotSet(self._source) + return self._source.value @property def ssh_url(self): @@ -530,7 +530,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._ssh_url) - return self._NoneIfNotSet(self._ssh_url) + return self._ssh_url.value @property def stargazers_url(self): @@ -538,7 +538,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._stargazers_url) - return self._NoneIfNotSet(self._stargazers_url) + return self._stargazers_url.value @property def statuses_url(self): @@ -546,7 +546,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._statuses_url) - return self._NoneIfNotSet(self._statuses_url) + return self._statuses_url.value @property def subscribers_url(self): @@ -554,7 +554,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._subscribers_url) - return self._NoneIfNotSet(self._subscribers_url) + return self._subscribers_url.value @property def subscription_url(self): @@ -562,7 +562,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._subscription_url) - return self._NoneIfNotSet(self._subscription_url) + return self._subscription_url.value @property def svn_url(self): @@ -570,7 +570,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._svn_url) - return self._NoneIfNotSet(self._svn_url) + return self._svn_url.value @property def tags_url(self): @@ -578,7 +578,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._tags_url) - return self._NoneIfNotSet(self._tags_url) + return self._tags_url.value @property def teams_url(self): @@ -586,7 +586,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._teams_url) - return self._NoneIfNotSet(self._teams_url) + return self._teams_url.value @property def trees_url(self): @@ -594,7 +594,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._trees_url) - return self._NoneIfNotSet(self._trees_url) + return self._trees_url.value @property def updated_at(self): @@ -602,7 +602,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: datetime.datetime """ self._completeIfNotSet(self._updated_at) - return self._NoneIfNotSet(self._updated_at) + return self._updated_at.value @property def url(self): @@ -610,7 +610,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def watchers(self): @@ -618,7 +618,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._watchers) - return self._NoneIfNotSet(self._watchers) + return self._watchers.value @property def watchers_count(self): @@ -626,7 +626,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._watchers_count) - return self._NoneIfNotSet(self._watchers_count) + return self._watchers_count.value def add_to_collaborators(self, collaborator): """ @@ -884,7 +884,7 @@ class Repository(github.GithubObject.CompletableGithubObject): self.url + "/keys", input=post_parameters ) - return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url) + return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url) def create_label(self, name, color): """ @@ -1517,7 +1517,7 @@ class Repository(github.GithubObject.CompletableGithubObject): "GET", self.url + "/keys/" + str(id) ) - return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self._url) + return github.RepositoryKey.RepositoryKey(self._requester, headers, data, completed=True, repoUrl=self.url) def get_keys(self): """ @@ -1525,7 +1525,7 @@ class Repository(github.GithubObject.CompletableGithubObject): :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.RepositoryKey.RepositoryKey` """ return github.PaginatedList.PaginatedList( - lambda requester, headers, data, completed: github.RepositoryKey.RepositoryKey(requester, headers, data, completed, repoUrl=self._url), + lambda requester, headers, data, completed: github.RepositoryKey.RepositoryKey(requester, headers, data, completed, repoUrl=self.url), self._requester, self.url + "/keys", None @@ -1870,7 +1870,7 @@ class Repository(github.GithubObject.CompletableGithubObject): post_parameters = { "hub.mode": mode, - "hub.topic": "https://github.com/" + self._full_name + "/events/" + event, + "hub.topic": "https://github.com/" + self.full_name + "/events/" + event, "hub.callback": callback, } if secret is not github.GithubObject.NotSet: @@ -1961,211 +1961,211 @@ class Repository(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "archive_url" in attributes: # pragma no branch assert attributes["archive_url"] is None or isinstance(attributes["archive_url"], (str, unicode)), attributes["archive_url"] - self._archive_url = attributes["archive_url"] + self._archive_url = github.GithubObject.ValuedAttribute(attributes["archive_url"]) if "assignees_url" in attributes: # pragma no branch assert attributes["assignees_url"] is None or isinstance(attributes["assignees_url"], (str, unicode)), attributes["assignees_url"] - self._assignees_url = attributes["assignees_url"] + self._assignees_url = github.GithubObject.ValuedAttribute(attributes["assignees_url"]) if "blobs_url" in attributes: # pragma no branch assert attributes["blobs_url"] is None or isinstance(attributes["blobs_url"], (str, unicode)), attributes["blobs_url"] - self._blobs_url = attributes["blobs_url"] + self._blobs_url = github.GithubObject.ValuedAttribute(attributes["blobs_url"]) if "branches_url" in attributes: # pragma no branch assert attributes["branches_url"] is None or isinstance(attributes["branches_url"], (str, unicode)), attributes["branches_url"] - self._branches_url = attributes["branches_url"] + self._branches_url = github.GithubObject.ValuedAttribute(attributes["branches_url"]) 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"] + self._clone_url = github.GithubObject.ValuedAttribute(attributes["clone_url"]) if "collaborators_url" in attributes: # pragma no branch assert attributes["collaborators_url"] is None or isinstance(attributes["collaborators_url"], (str, unicode)), attributes["collaborators_url"] - self._collaborators_url = attributes["collaborators_url"] + self._collaborators_url = github.GithubObject.ValuedAttribute(attributes["collaborators_url"]) if "comments_url" in attributes: # pragma no branch assert attributes["comments_url"] is None or isinstance(attributes["comments_url"], (str, unicode)), attributes["comments_url"] - self._comments_url = attributes["comments_url"] + self._comments_url = github.GithubObject.ValuedAttribute(attributes["comments_url"]) if "commits_url" in attributes: # pragma no branch assert attributes["commits_url"] is None or isinstance(attributes["commits_url"], (str, unicode)), attributes["commits_url"] - self._commits_url = attributes["commits_url"] + self._commits_url = github.GithubObject.ValuedAttribute(attributes["commits_url"]) if "compare_url" in attributes: # pragma no branch assert attributes["compare_url"] is None or isinstance(attributes["compare_url"], (str, unicode)), attributes["compare_url"] - self._compare_url = attributes["compare_url"] + self._compare_url = github.GithubObject.ValuedAttribute(attributes["compare_url"]) if "contents_url" in attributes: # pragma no branch assert attributes["contents_url"] is None or isinstance(attributes["contents_url"], (str, unicode)), attributes["contents_url"] - self._contents_url = attributes["contents_url"] + self._contents_url = github.GithubObject.ValuedAttribute(attributes["contents_url"]) if "contributors_url" in attributes: # pragma no branch assert attributes["contributors_url"] is None or isinstance(attributes["contributors_url"], (str, unicode)), attributes["contributors_url"] - self._contributors_url = attributes["contributors_url"] + self._contributors_url = github.GithubObject.ValuedAttribute(attributes["contributors_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"]) + self._created_at = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_at"])) if "default_branch" in attributes: # pragma no branch assert attributes["default_branch"] is None or isinstance(attributes["default_branch"], (str, unicode)), attributes["default_branch"] - self._default_branch = attributes["default_branch"] + self._default_branch = github.GithubObject.ValuedAttribute(attributes["default_branch"]) if "description" in attributes: # pragma no branch assert attributes["description"] is None or isinstance(attributes["description"], (str, unicode)), attributes["description"] - self._description = attributes["description"] + self._description = github.GithubObject.ValuedAttribute(attributes["description"]) if "downloads_url" in attributes: # pragma no branch assert attributes["downloads_url"] is None or isinstance(attributes["downloads_url"], (str, unicode)), attributes["downloads_url"] - self._downloads_url = attributes["downloads_url"] + self._downloads_url = github.GithubObject.ValuedAttribute(attributes["downloads_url"]) if "events_url" in attributes: # pragma no branch assert attributes["events_url"] is None or isinstance(attributes["events_url"], (str, unicode)), attributes["events_url"] - self._events_url = attributes["events_url"] + self._events_url = github.GithubObject.ValuedAttribute(attributes["events_url"]) if "fork" in attributes: # pragma no branch assert attributes["fork"] is None or isinstance(attributes["fork"], bool), attributes["fork"] - self._fork = attributes["fork"] + self._fork = github.GithubObject.ValuedAttribute(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"] + self._forks = github.GithubObject.ValuedAttribute(attributes["forks"]) if "forks_count" in attributes: # pragma no branch assert attributes["forks_count"] is None or isinstance(attributes["forks_count"], (int, long)), attributes["forks_count"] - self._forks_count = attributes["forks_count"] + self._forks_count = github.GithubObject.ValuedAttribute(attributes["forks_count"]) if "forks_url" in attributes: # pragma no branch assert attributes["forks_url"] is None or isinstance(attributes["forks_url"], (str, unicode)), attributes["forks_url"] - self._forks_url = attributes["forks_url"] + self._forks_url = github.GithubObject.ValuedAttribute(attributes["forks_url"]) 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"] + self._full_name = github.GithubObject.ValuedAttribute(attributes["full_name"]) if "git_commits_url" in attributes: # pragma no branch assert attributes["git_commits_url"] is None or isinstance(attributes["git_commits_url"], (str, unicode)), attributes["git_commits_url"] - self._git_commits_url = attributes["git_commits_url"] + self._git_commits_url = github.GithubObject.ValuedAttribute(attributes["git_commits_url"]) if "git_refs_url" in attributes: # pragma no branch assert attributes["git_refs_url"] is None or isinstance(attributes["git_refs_url"], (str, unicode)), attributes["git_refs_url"] - self._git_refs_url = attributes["git_refs_url"] + self._git_refs_url = github.GithubObject.ValuedAttribute(attributes["git_refs_url"]) if "git_tags_url" in attributes: # pragma no branch assert attributes["git_tags_url"] is None or isinstance(attributes["git_tags_url"], (str, unicode)), attributes["git_tags_url"] - self._git_tags_url = attributes["git_tags_url"] + self._git_tags_url = github.GithubObject.ValuedAttribute(attributes["git_tags_url"]) 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"] + self._git_url = github.GithubObject.ValuedAttribute(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"] + self._has_downloads = github.GithubObject.ValuedAttribute(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"] + self._has_issues = github.GithubObject.ValuedAttribute(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"] + self._has_wiki = github.GithubObject.ValuedAttribute(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"] + self._homepage = github.GithubObject.ValuedAttribute(attributes["homepage"]) if "hooks_url" in attributes: # pragma no branch assert attributes["hooks_url"] is None or isinstance(attributes["hooks_url"], (str, unicode)), attributes["hooks_url"] - self._hooks_url = attributes["hooks_url"] + self._hooks_url = github.GithubObject.ValuedAttribute(attributes["hooks_url"]) 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"] + self._html_url = github.GithubObject.ValuedAttribute(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"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "issue_comment_url" in attributes: # pragma no branch assert attributes["issue_comment_url"] is None or isinstance(attributes["issue_comment_url"], (str, unicode)), attributes["issue_comment_url"] - self._issue_comment_url = attributes["issue_comment_url"] + self._issue_comment_url = github.GithubObject.ValuedAttribute(attributes["issue_comment_url"]) if "issue_events_url" in attributes: # pragma no branch assert attributes["issue_events_url"] is None or isinstance(attributes["issue_events_url"], (str, unicode)), attributes["issue_events_url"] - self._issue_events_url = attributes["issue_events_url"] + self._issue_events_url = github.GithubObject.ValuedAttribute(attributes["issue_events_url"]) if "issues_url" in attributes: # pragma no branch assert attributes["issues_url"] is None or isinstance(attributes["issues_url"], (str, unicode)), attributes["issues_url"] - self._issues_url = attributes["issues_url"] + self._issues_url = github.GithubObject.ValuedAttribute(attributes["issues_url"]) if "keys_url" in attributes: # pragma no branch assert attributes["keys_url"] is None or isinstance(attributes["keys_url"], (str, unicode)), attributes["keys_url"] - self._keys_url = attributes["keys_url"] + self._keys_url = github.GithubObject.ValuedAttribute(attributes["keys_url"]) if "labels_url" in attributes: # pragma no branch assert attributes["labels_url"] is None or isinstance(attributes["labels_url"], (str, unicode)), attributes["labels_url"] - self._labels_url = attributes["labels_url"] + self._labels_url = github.GithubObject.ValuedAttribute(attributes["labels_url"]) if "language" in attributes: # pragma no branch assert attributes["language"] is None or isinstance(attributes["language"], (str, unicode)), attributes["language"] - self._language = attributes["language"] + self._language = github.GithubObject.ValuedAttribute(attributes["language"]) if "languages_url" in attributes: # pragma no branch assert attributes["languages_url"] is None or isinstance(attributes["languages_url"], (str, unicode)), attributes["languages_url"] - self._languages_url = attributes["languages_url"] + self._languages_url = github.GithubObject.ValuedAttribute(attributes["languages_url"]) 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"] + self._master_branch = github.GithubObject.ValuedAttribute(attributes["master_branch"]) if "merges_url" in attributes: # pragma no branch assert attributes["merges_url"] is None or isinstance(attributes["merges_url"], (str, unicode)), attributes["merges_url"] - self._merges_url = attributes["merges_url"] + self._merges_url = github.GithubObject.ValuedAttribute(attributes["merges_url"]) if "milestones_url" in attributes: # pragma no branch assert attributes["milestones_url"] is None or isinstance(attributes["milestones_url"], (str, unicode)), attributes["milestones_url"] - self._milestones_url = attributes["milestones_url"] + self._milestones_url = github.GithubObject.ValuedAttribute(attributes["milestones_url"]) if "mirror_url" in attributes: # pragma no branch assert attributes["mirror_url"] is None or isinstance(attributes["mirror_url"], (str, unicode)), attributes["mirror_url"] - self._mirror_url = attributes["mirror_url"] + self._mirror_url = github.GithubObject.ValuedAttribute(attributes["mirror_url"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "network_count" in attributes: # pragma no branch assert attributes["network_count"] is None or isinstance(attributes["network_count"], (int, long)), attributes["network_count"] - self._network_count = attributes["network_count"] + self._network_count = github.GithubObject.ValuedAttribute(attributes["network_count"]) if "notifications_url" in attributes: # pragma no branch assert attributes["notifications_url"] is None or isinstance(attributes["notifications_url"], (str, unicode)), attributes["notifications_url"] - self._notifications_url = attributes["notifications_url"] + self._notifications_url = github.GithubObject.ValuedAttribute(attributes["notifications_url"]) 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"] + self._open_issues = github.GithubObject.ValuedAttribute(attributes["open_issues"]) if "open_issues_count" in attributes: # pragma no branch assert attributes["open_issues_count"] is None or isinstance(attributes["open_issues_count"], (int, long)), attributes["open_issues_count"] - self._open_issues_count = attributes["open_issues_count"] + self._open_issues_count = github.GithubObject.ValuedAttribute(attributes["open_issues_count"]) 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 github.Organization.Organization(self._requester, self._headers, attributes["organization"], completed=False) + self._organization = github.GithubObject.ValuedAttribute(None if attributes["organization"] is None else github.Organization.Organization(self._requester, self._headers, 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 github.NamedUser.NamedUser(self._requester, self._headers, attributes["owner"], completed=False) + self._owner = github.GithubObject.ValuedAttribute(None if attributes["owner"] is None else github.NamedUser.NamedUser(self._requester, self._headers, 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, self._headers, attributes["parent"], completed=False) + self._parent = github.GithubObject.ValuedAttribute(None if attributes["parent"] is None else Repository(self._requester, self._headers, 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 github.Permissions.Permissions(self._requester, self._headers, attributes["permissions"], completed=False) + self._permissions = github.GithubObject.ValuedAttribute(None if attributes["permissions"] is None else github.Permissions.Permissions(self._requester, self._headers, 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"] + self._private = github.GithubObject.ValuedAttribute(attributes["private"]) if "pulls_url" in attributes: # pragma no branch assert attributes["pulls_url"] is None or isinstance(attributes["pulls_url"], (str, unicode)), attributes["pulls_url"] - self._pulls_url = attributes["pulls_url"] + self._pulls_url = github.GithubObject.ValuedAttribute(attributes["pulls_url"]) 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"]) + self._pushed_at = github.GithubObject.ValuedAttribute(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"] + self._size = github.GithubObject.ValuedAttribute(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, self._headers, attributes["source"], completed=False) + self._source = github.GithubObject.ValuedAttribute(None if attributes["source"] is None else Repository(self._requester, self._headers, 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"] + self._ssh_url = github.GithubObject.ValuedAttribute(attributes["ssh_url"]) if "stargazers_url" in attributes: # pragma no branch assert attributes["stargazers_url"] is None or isinstance(attributes["stargazers_url"], (str, unicode)), attributes["stargazers_url"] - self._stargazers_url = attributes["stargazers_url"] + self._stargazers_url = github.GithubObject.ValuedAttribute(attributes["stargazers_url"]) if "statuses_url" in attributes: # pragma no branch assert attributes["statuses_url"] is None or isinstance(attributes["statuses_url"], (str, unicode)), attributes["statuses_url"] - self._statuses_url = attributes["statuses_url"] + self._statuses_url = github.GithubObject.ValuedAttribute(attributes["statuses_url"]) if "subscribers_url" in attributes: # pragma no branch assert attributes["subscribers_url"] is None or isinstance(attributes["subscribers_url"], (str, unicode)), attributes["subscribers_url"] - self._subscribers_url = attributes["subscribers_url"] + self._subscribers_url = github.GithubObject.ValuedAttribute(attributes["subscribers_url"]) if "subscription_url" in attributes: # pragma no branch assert attributes["subscription_url"] is None or isinstance(attributes["subscription_url"], (str, unicode)), attributes["subscription_url"] - self._subscription_url = attributes["subscription_url"] + self._subscription_url = github.GithubObject.ValuedAttribute(attributes["subscription_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"] + self._svn_url = github.GithubObject.ValuedAttribute(attributes["svn_url"]) if "tags_url" in attributes: # pragma no branch assert attributes["tags_url"] is None or isinstance(attributes["tags_url"], (str, unicode)), attributes["tags_url"] - self._tags_url = attributes["tags_url"] + self._tags_url = github.GithubObject.ValuedAttribute(attributes["tags_url"]) if "teams_url" in attributes: # pragma no branch assert attributes["teams_url"] is None or isinstance(attributes["teams_url"], (str, unicode)), attributes["teams_url"] - self._teams_url = attributes["teams_url"] + self._teams_url = github.GithubObject.ValuedAttribute(attributes["teams_url"]) if "trees_url" in attributes: # pragma no branch assert attributes["trees_url"] is None or isinstance(attributes["trees_url"], (str, unicode)), attributes["trees_url"] - self._trees_url = attributes["trees_url"] + self._trees_url = github.GithubObject.ValuedAttribute(attributes["trees_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"]) + self._updated_at = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(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"] + self._watchers = github.GithubObject.ValuedAttribute(attributes["watchers"]) if "watchers_count" in attributes: # pragma no branch assert attributes["watchers_count"] is None or isinstance(attributes["watchers_count"], (int, long)), attributes["watchers_count"] - self._watchers_count = attributes["watchers_count"] + self._watchers_count = github.GithubObject.ValuedAttribute(attributes["watchers_count"]) diff --git a/github/RepositoryKey.py b/github/RepositoryKey.py index 69e1c616..90bccd08 100644 --- a/github/RepositoryKey.py +++ b/github/RepositoryKey.py @@ -48,7 +48,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def key(self): @@ -56,7 +56,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._key) - return self._NoneIfNotSet(self._key) + return self._key.value @property def title(self): @@ -64,7 +64,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._title) - return self._NoneIfNotSet(self._title) + return self._title.value @property def url(self): @@ -72,7 +72,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def verified(self): @@ -80,7 +80,7 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._verified) - return self._NoneIfNotSet(self._verified) + return self._verified.value def delete(self): """ @@ -123,16 +123,16 @@ class RepositoryKey(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "key" in attributes: # pragma no branch assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"] - self._key = attributes["key"] + self._key = github.GithubObject.ValuedAttribute(attributes["key"]) if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] - self._title = attributes["title"] + self._title = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) if "verified" in attributes: # pragma no branch assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"] - self._verified = attributes["verified"] + self._verified = github.GithubObject.ValuedAttribute(attributes["verified"]) diff --git a/github/Status.py b/github/Status.py index 6c117241..c25c6a23 100644 --- a/github/Status.py +++ b/github/Status.py @@ -34,14 +34,14 @@ class Status(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._status) + return self._status.value @property def last_updated(self): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._last_updated) + return self._last_updated.value def _initAttributes(self): self._status = github.GithubObject.NotSet @@ -50,7 +50,7 @@ class Status(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): if "status" in attributes: # pragma no branch assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] - self._status = attributes["status"] + self._status = github.GithubObject.ValuedAttribute(attributes["status"]) if "last_updated" in attributes: # pragma no branch assert attributes["last_updated"] is None or isinstance(attributes["last_updated"], (str, unicode)), attributes["last_updated"] - self._last_updated = self._parseDatetime(attributes["last_updated"]) + self._last_updated = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["last_updated"])) diff --git a/github/StatusMessage.py b/github/StatusMessage.py index 266e1b05..a99e72ec 100644 --- a/github/StatusMessage.py +++ b/github/StatusMessage.py @@ -34,21 +34,21 @@ class StatusMessage(github.GithubObject.NonCompletableGithubObject): """ :type: string """ - return self._NoneIfNotSet(self._body) + return self._body.value @property def status(self): """ :type: string """ - return self._NoneIfNotSet(self._status) + return self._status.value @property def created_on(self): """ :type: datetime.datetime """ - return self._NoneIfNotSet(self._created_on) + return self._created_on.value def _initAttributes(self): self._status = github.GithubObject.NotSet @@ -57,10 +57,10 @@ class StatusMessage(github.GithubObject.NonCompletableGithubObject): 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"] + self._body = github.GithubObject.ValuedAttribute(attributes["body"]) if "status" in attributes: # pragma no branch assert attributes["status"] is None or isinstance(attributes["status"], (str, unicode)), attributes["status"] - self._status = attributes["status"] + self._status = github.GithubObject.ValuedAttribute(attributes["status"]) if "created_on" in attributes: # pragma no branch assert attributes["created_on"] is None or isinstance(attributes["created_on"], (str, unicode)), attributes["created_on"] - self._created_on = self._parseDatetime(attributes["created_on"]) + self._created_on = github.GithubObject.ValuedAttribute(self._parseDatetime(attributes["created_on"])) diff --git a/github/Tag.py b/github/Tag.py index 890c1a02..14b19420 100644 --- a/github/Tag.py +++ b/github/Tag.py @@ -40,28 +40,28 @@ class Tag(github.GithubObject.NonCompletableGithubObject): """ :type: :class:`github.Commit.Commit` """ - return self._NoneIfNotSet(self._commit) + return self._commit.value @property def name(self): """ :type: string """ - return self._NoneIfNotSet(self._name) + return self._name.value @property def tarball_url(self): """ :type: string """ - return self._NoneIfNotSet(self._tarball_url) + return self._tarball_url.value @property def zipball_url(self): """ :type: string """ - return self._NoneIfNotSet(self._zipball_url) + return self._zipball_url.value def _initAttributes(self): self._commit = github.GithubObject.NotSet @@ -72,13 +72,13 @@ class Tag(github.GithubObject.NonCompletableGithubObject): def _useAttributes(self, attributes): 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 github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False) + self._commit = github.GithubObject.ValuedAttribute(None if attributes["commit"] is None else github.Commit.Commit(self._requester, self._headers, attributes["commit"], completed=False)) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "tarball_url" in attributes: # pragma no branch assert attributes["tarball_url"] is None or isinstance(attributes["tarball_url"], (str, unicode)), attributes["tarball_url"] - self._tarball_url = attributes["tarball_url"] + self._tarball_url = github.GithubObject.ValuedAttribute(attributes["tarball_url"]) if "zipball_url" in attributes: # pragma no branch assert attributes["zipball_url"] is None or isinstance(attributes["zipball_url"], (str, unicode)), attributes["zipball_url"] - self._zipball_url = attributes["zipball_url"] + self._zipball_url = github.GithubObject.ValuedAttribute(attributes["zipball_url"]) diff --git a/github/Team.py b/github/Team.py index c3c2abbf..ccb0b1f5 100644 --- a/github/Team.py +++ b/github/Team.py @@ -43,7 +43,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def members_count(self): @@ -51,7 +51,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._members_count) - return self._NoneIfNotSet(self._members_count) + return self._members_count.value @property def members_url(self): @@ -59,7 +59,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._members_url) - return self._NoneIfNotSet(self._members_url) + return self._members_url.value @property def name(self): @@ -67,7 +67,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._name) - return self._NoneIfNotSet(self._name) + return self._name.value @property def permission(self): @@ -75,7 +75,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._permission) - return self._NoneIfNotSet(self._permission) + return self._permission.value @property def repos_count(self): @@ -83,7 +83,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._repos_count) - return self._NoneIfNotSet(self._repos_count) + return self._repos_count.value @property def repositories_url(self): @@ -91,7 +91,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._repositories_url) - return self._NoneIfNotSet(self._repositories_url) + return self._repositories_url.value @property def slug(self): @@ -99,7 +99,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._slug) - return self._NoneIfNotSet(self._slug) + return self._slug.value @property def url(self): @@ -107,7 +107,7 @@ class Team(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value def add_to_members(self, member): """ @@ -256,28 +256,28 @@ class Team(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "members_count" in attributes: # pragma no branch assert attributes["members_count"] is None or isinstance(attributes["members_count"], (int, long)), attributes["members_count"] - self._members_count = attributes["members_count"] + self._members_count = github.GithubObject.ValuedAttribute(attributes["members_count"]) if "members_url" in attributes: # pragma no branch assert attributes["members_url"] is None or isinstance(attributes["members_url"], (str, unicode)), attributes["members_url"] - self._members_url = attributes["members_url"] + self._members_url = github.GithubObject.ValuedAttribute(attributes["members_url"]) if "name" in attributes: # pragma no branch assert attributes["name"] is None or isinstance(attributes["name"], (str, unicode)), attributes["name"] - self._name = attributes["name"] + self._name = github.GithubObject.ValuedAttribute(attributes["name"]) if "permission" in attributes: # pragma no branch assert attributes["permission"] is None or isinstance(attributes["permission"], (str, unicode)), attributes["permission"] - self._permission = attributes["permission"] + self._permission = github.GithubObject.ValuedAttribute(attributes["permission"]) if "repos_count" in attributes: # pragma no branch assert attributes["repos_count"] is None or isinstance(attributes["repos_count"], (int, long)), attributes["repos_count"] - self._repos_count = attributes["repos_count"] + self._repos_count = github.GithubObject.ValuedAttribute(attributes["repos_count"]) if "repositories_url" in attributes: # pragma no branch assert attributes["repositories_url"] is None or isinstance(attributes["repositories_url"], (str, unicode)), attributes["repositories_url"] - self._repositories_url = attributes["repositories_url"] + self._repositories_url = github.GithubObject.ValuedAttribute(attributes["repositories_url"]) if "slug" in attributes: # pragma no branch assert attributes["slug"] is None or isinstance(attributes["slug"], (str, unicode)), attributes["slug"] - self._slug = attributes["slug"] + self._slug = github.GithubObject.ValuedAttribute(attributes["slug"]) if "url" in attributes: # pragma no branch assert attributes["url"] is None or isinstance(attributes["url"], (str, unicode)), attributes["url"] - self._url = attributes["url"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) diff --git a/github/UserKey.py b/github/UserKey.py index 9ca0133b..66b240f5 100644 --- a/github/UserKey.py +++ b/github/UserKey.py @@ -39,7 +39,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): :type: integer """ self._completeIfNotSet(self._id) - return self._NoneIfNotSet(self._id) + return self._id.value @property def key(self): @@ -47,7 +47,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._key) - return self._NoneIfNotSet(self._key) + return self._key.value @property def title(self): @@ -55,7 +55,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._title) - return self._NoneIfNotSet(self._title) + return self._title.value @property def url(self): @@ -63,7 +63,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): :type: string """ self._completeIfNotSet(self._url) - return self._NoneIfNotSet(self._url) + return self._url.value @property def verified(self): @@ -71,7 +71,7 @@ class UserKey(github.GithubObject.CompletableGithubObject): :type: bool """ self._completeIfNotSet(self._verified) - return self._NoneIfNotSet(self._verified) + return self._verified.value def delete(self): """ @@ -114,16 +114,16 @@ class UserKey(github.GithubObject.CompletableGithubObject): def _useAttributes(self, attributes): if "id" in attributes: # pragma no branch assert attributes["id"] is None or isinstance(attributes["id"], (int, long)), attributes["id"] - self._id = attributes["id"] + self._id = github.GithubObject.ValuedAttribute(attributes["id"]) if "key" in attributes: # pragma no branch assert attributes["key"] is None or isinstance(attributes["key"], (str, unicode)), attributes["key"] - self._key = attributes["key"] + self._key = github.GithubObject.ValuedAttribute(attributes["key"]) if "title" in attributes: # pragma no branch assert attributes["title"] is None or isinstance(attributes["title"], (str, unicode)), attributes["title"] - self._title = attributes["title"] + self._title = github.GithubObject.ValuedAttribute(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"] + self._url = github.GithubObject.ValuedAttribute(attributes["url"]) if "verified" in attributes: # pragma no branch assert attributes["verified"] is None or isinstance(attributes["verified"], bool), attributes["verified"] - self._verified = attributes["verified"] + self._verified = github.GithubObject.ValuedAttribute(attributes["verified"])