Merge branch 'topic/RaiseLaterInCaseOfBadData' into develop

This commit is contained in:
Vincent Jacques
2013-09-12 11:45:58 +02:00
69 changed files with 1473 additions and 1703 deletions
+1
View File
@@ -20,6 +20,7 @@ Starting today (September 5th, 2013), we now need more than 8 bits to store the
-----------------------------------------------------------------------------------------------------------
* `Implement <https://github.com/jacquev6/PyGithub/issues/196>`_ ``Github.get_hook(name)``. Thank you `klmitch <https://github.com/klmitch>`_ for asking
* In case bad data is returned by Github API v3, `raise <https://github.com/jacquev6/PyGithub/issues/195>`_ an exception only when the user accesses the faulty attribute, not when constructing the object containing this attribute. Thank you `klmitch <https://github.com/klmitch>`_ for asking
What's missing?
===============
+1 -5
View File
@@ -9,11 +9,7 @@ Logging
Error Handling
--------------
.. autoclass:: github.GithubException.GithubException()
.. autoclass:: github.GithubException.BadCredentialsException()
.. autoclass:: github.GithubException.UnknownObjectException()
.. autoclass:: github.GithubException.BadUserAgentException()
.. autoclass:: github.GithubException.RateLimitExceededException()
.. automodule:: github.GithubException
Default argument
----------------
+72 -108
View File
@@ -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):
"""
@@ -1066,110 +1066,74 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+18 -27
View File
@@ -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):
"""
@@ -162,29 +162,20 @@ 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 = self._makeClassAttribute(github.AuthorizationApplication.AuthorizationApplication, attributes["app"])
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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeListOfStringsAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+4 -6
View File
@@ -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
@@ -54,8 +54,6 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+4 -6
View File
@@ -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
@@ -55,8 +55,6 @@ 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 = self._makeClassAttribute(github.Commit.Commit, attributes["commit"])
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 = self._makeStringAttribute(attributes["name"])
+20 -36
View File
@@ -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):
"""
@@ -217,38 +217,22 @@ 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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"])
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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.GitCommit.GitCommit, attributes["commit"])
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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["committer"])
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 [
github.File.File(self._requester, self._headers, element, completed=False)
for element in attributes["files"]
]
self._files = self._makeListOfClassesAttribute(github.File.File, 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 = self._makeStringAttribute(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 [
Commit(self._requester, self._headers, element, completed=False)
for element in attributes["parents"]
]
self._parents = self._makeListOfClassesAttribute(Commit, 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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.CommitStats.CommitStats, attributes["stats"])
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 = self._makeStringAttribute(attributes["url"])
+22 -33
View File
@@ -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):
"""
@@ -164,35 +164,24 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(attributes["total"])
+16 -24
View File
@@ -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
@@ -102,26 +102,18 @@ 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 = self._makeDatetimeAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+26 -45
View File
@@ -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
@@ -156,47 +156,28 @@ 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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Commit.Commit, attributes["base_commit"])
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 = self._makeIntAttribute(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 [
github.Commit.Commit(self._requester, self._headers, element, completed=False)
for element in attributes["commits"]
]
self._commits = self._makeListOfClassesAttribute(github.Commit.Commit, 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 = self._makeStringAttribute(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 [
github.File.File(self._requester, self._headers, element, completed=False)
for element in attributes["files"]
]
self._files = self._makeListOfClassesAttribute(github.File.File, 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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.Commit.Commit, attributes["merge_base_commit"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(attributes["url"])
+20 -30
View File
@@ -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
@@ -125,32 +125,22 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+40 -60
View File
@@ -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):
"""
@@ -226,62 +226,42 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(attributes["url"])
+16 -24
View File
@@ -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
@@ -105,26 +105,18 @@ 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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"])
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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.Organization.Organization, attributes["org"])
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 = self._makeDictAttribute(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 = self._makeBoolAttribute(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 = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
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 = self._makeStringAttribute(attributes["type"])
+20 -30
View File
@@ -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
@@ -116,32 +116,22 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["status"])
+36 -63
View File
@@ -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):
"""
@@ -320,65 +320,38 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["description"])
if "files" in attributes: # pragma no branch
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"]
self._files = None if attributes["files"] is None else dict(
(key, github.GistFile.GistFile(self._requester, self._headers, element, completed=False))
for key, element in attributes["files"].iteritems()
)
self._files = self._makeDictOfStringsToClassesAttribute(github.GistFile.GistFile, attributes["files"])
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 = self._makeClassAttribute(Gist, attributes["fork_of"])
if "forks" in attributes: # pragma no branch
assert attributes["forks"] is None or all(isinstance(element, dict) for element in attributes["forks"]), attributes["forks"]
self._forks = None if attributes["forks"] is None else [
Gist(self._requester, self._headers, element, completed=False)
for element in attributes["forks"]
]
self._forks = self._makeListOfClassesAttribute(Gist, 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 [
github.GistHistoryState.GistHistoryState(self._requester, self._headers, element, completed=False)
for element in attributes["history"]
]
self._history = self._makeListOfClassesAttribute(github.GistHistoryState.GistHistoryState, 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+12 -18
View File
@@ -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):
"""
@@ -119,20 +119,14 @@ 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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+12 -18
View File
@@ -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
@@ -84,20 +84,14 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(attributes["type"])
+40 -69
View File
@@ -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
@@ -220,71 +220,42 @@ 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 = self._makeClassAttribute(github.CommitStats.CommitStats, attributes["change_status"])
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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["description"])
if "files" in attributes: # pragma no branch
assert attributes["files"] is None or all(isinstance(element, dict) for element in attributes["files"].itervalues()), attributes["files"]
self._files = None if attributes["files"] is None else dict(
(key, github.GistFile.GistFile(self._requester, self._headers, element, completed=False))
for key, element in attributes["files"].iteritems()
)
self._files = self._makeDictOfStringsToClassesAttribute(github.GistFile.GistFile, attributes["files"])
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 [
github.Gist.Gist(self._requester, self._headers, element, completed=False)
for element in attributes["forks"]
]
self._forks = self._makeListOfClassesAttribute(github.Gist.Gist, 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["git_push_url"])
if "history" in attributes: # pragma no branch
assert attributes["history"] is None or all(isinstance(element, dict) for element in attributes["history"]), attributes["history"]
self._history = None if attributes["history"] is None else [
GistHistoryState(self._requester, self._headers, element, completed=False)
for element in attributes["history"]
]
self._history = self._makeListOfClassesAttribute(GistHistoryState, 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
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 = self._makeStringAttribute(attributes["version"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["name"])
+10 -15
View File
@@ -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
@@ -81,17 +81,12 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(attributes["url"])
+16 -27
View File
@@ -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):
@@ -115,29 +115,18 @@ 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 = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"])
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 = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["committer"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 [
GitCommit(self._requester, self._headers, element, completed=False)
for element in attributes["parents"]
]
self._parents = self._makeListOfClassesAttribute(GitCommit, 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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.GitTree.GitTree, 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 = self._makeStringAttribute(attributes["url"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+6 -9
View File
@@ -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):
"""
@@ -96,11 +96,8 @@ 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 = self._makeClassAttribute(github.GitObject.GitObject, attributes["object"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+12 -18
View File
@@ -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
@@ -93,20 +93,14 @@ 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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.GitObject.GitObject, attributes["object"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["tagger"])
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 = self._makeStringAttribute(attributes["url"])
+6 -12
View File
@@ -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):
@@ -69,14 +69,8 @@ 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 = self._makeStringAttribute(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 [
github.GitTreeElement.GitTreeElement(self._requester, self._headers, element, completed=False)
for element in attributes["tree"]
]
self._tree = self._makeListOfClassesAttribute(github.GitTreeElement.GitTreeElement, 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 = self._makeStringAttribute(attributes["url"])
+12 -18
View File
@@ -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
@@ -84,20 +84,14 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+32 -1
View File
@@ -27,7 +27,7 @@
class GithubException(Exception):
"""
Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub.
Error handling in PyGithub is done with exceptions. This class is the base of all exceptions raised by PyGithub (but :class:`github.GithubException.BadAttributeException`).
Some other types of exceptions might be raised by underlying libraries, for example for network-related issues.
"""
@@ -77,3 +77,34 @@ class RateLimitExceededException(GithubException):
"""
Exception raised when the rate limit is exceeded (when Github API replies with a 403 rate limit exceeded HTML status)
"""
class BadAttributeException(Exception):
"""
Exception raised when Github returns an attribute with the wrong type.
"""
def __init__(self, actualValue, expectedType, transformationException):
self.__actualValue = actualValue
self.__expectedType = expectedType
self.__transformationException = transformationException
@property
def actual_value(self):
"""
The value returned by Github
"""
return self.__actualValue
@property
def expected_type(self):
"""
The type PyGithub expected
"""
return self.__expectedType
@property
def transformation_exception(self):
"""
The exception raised when PyGithub tried to parse the value
"""
return self.__transformationException
+95 -14
View File
@@ -33,9 +33,27 @@ import Consts
class _NotSetType:
def __repr__(self):
return "NotSet"
value = None
NotSet = _NotSetType()
class _ValuedAttribute:
def __init__(self, value):
self.value = value
class _BadAttribute:
def __init__(self, value, expectedType, exception=None):
self.__value = value
self.__expectedType = expectedType
self.__exception = exception
@property
def value(self):
raise GithubException.BadAttributeException(self.__value, self.__expectedType, self.__exception)
class GithubObject(object):
"""
Base class for all classes representing objects returned by the API.
@@ -88,22 +106,85 @@ class GithubObject(object):
return "/".join(url.split("/")[: -1])
@staticmethod
def _NoneIfNotSet(value):
if value is NotSet:
return None
def __makeSimpleAttribute(value, type):
if value is None or isinstance(value, type):
return _ValuedAttribute(value)
else:
return value
return _BadAttribute(value, type)
@staticmethod
def _parseDatetime(s):
if s is None:
return None
elif len(s) == 24:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
elif len(s) == 25:
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
def __makeSimpleListAttribute(value, type):
if isinstance(value, list) and all(isinstance(element, type) for element in value):
return _ValuedAttribute(value)
else:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
return _BadAttribute(value, [type])
@staticmethod
def __makeTransformedAttribute(value, type, transform):
if value is None:
return _ValuedAttribute(None)
elif isinstance(value, type):
try:
return _ValuedAttribute(transform(value))
except Exception, e:
return _BadAttribute(value, type, e)
else:
return _BadAttribute(value, type)
@staticmethod
def _makeStringAttribute(value):
return GithubObject.__makeSimpleAttribute(value, (str, unicode))
@staticmethod
def _makeIntAttribute(value):
return GithubObject.__makeSimpleAttribute(value, (int, long))
@staticmethod
def _makeBoolAttribute(value):
return GithubObject.__makeSimpleAttribute(value, bool)
@staticmethod
def _makeDictAttribute(value):
return GithubObject.__makeSimpleAttribute(value, dict)
@staticmethod
def _makeTimestampAttribute(value):
return GithubObject.__makeTransformedAttribute(value, (int, long), datetime.datetime.utcfromtimestamp)
@staticmethod
def _makeDatetimeAttribute(value):
def parseDatetime(s):
if len(s) == 24:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
elif len(s) == 25:
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
else:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
return GithubObject.__makeTransformedAttribute(value, (str, unicode), parseDatetime)
def _makeClassAttribute(self, klass, value):
return GithubObject.__makeTransformedAttribute(value, dict, lambda value: klass(self._requester, self._headers, value, completed=False))
@staticmethod
def _makeListOfStringsAttribute(value):
return GithubObject.__makeSimpleListAttribute(value, (str, unicode))
@staticmethod
def _makeListOfListOfStringsAttribute(value):
return GithubObject.__makeSimpleListAttribute(value, list)
def _makeListOfClassesAttribute(self, klass, value):
if isinstance(value, list) and all(isinstance(element, dict) for element in value):
return _ValuedAttribute([klass(self._requester, self._headers, element, completed=False) for element in value])
else:
return _BadAttribute(value, [dict])
def _makeDictOfStringsToClassesAttribute(self, klass, value):
if isinstance(value, dict) and all(isinstance(key, (str, unicode)) and isinstance(element, dict) for key, element in value.iteritems()):
return _ValuedAttribute(dict((key, klass(self._requester, self._headers, element, completed=False)) for key, element in value.iteritems()))
else:
return _BadAttribute(value, {(str, unicode): dict})
@property
def etag(self):
@@ -141,7 +222,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 +240,7 @@ class CompletableGithubObject(GithubObject):
status, responseHeaders, output = self._requester.requestJson(
"GET",
self._url,
self._url.value,
headers=conditionalRequestHeader
)
if status == 304:
+4 -6
View File
@@ -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
@@ -51,8 +51,6 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["name"])
+20 -30
View File
@@ -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):
"""
@@ -184,32 +184,22 @@ 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 = self._makeBoolAttribute(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 = self._makeDictAttribute(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 = self._makeDatetimeAttribute(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 = self._makeListOfStringsAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.HookResponse.HookResponse, attributes["last_response"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+8 -12
View File
@@ -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
@@ -68,14 +68,10 @@ 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 = self._makeListOfStringsAttribute(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 = self._makeStringAttribute(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 = self._makeListOfListOfStringsAttribute(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 = self._makeListOfStringsAttribute(attributes["supported_events"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["status"])
+43 -67
View File
@@ -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):
"""
@@ -398,68 +398,44 @@ 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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["closed_by"])
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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 [
github.Label.Label(self._requester, self._headers, element, completed=False)
for element in attributes["labels"]
]
self._labels = self._makeListOfClassesAttribute(github.Label.Label, 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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.IssuePullRequest.IssuePullRequest, attributes["pull_request"])
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 = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+16 -24
View File
@@ -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):
"""
@@ -138,26 +138,18 @@ 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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+14 -21
View File
@@ -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
@@ -102,23 +102,16 @@ 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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"])
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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Issue.Issue, attributes["issue"])
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 = self._makeStringAttribute(attributes["url"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["patch_url"])
+6 -9
View File
@@ -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):
"""
@@ -100,11 +100,8 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+26 -39
View File
@@ -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):
"""
@@ -215,41 +215,28 @@ 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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["creator"])
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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+72 -108
View File
@@ -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):
@@ -585,110 +585,74 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+18 -27
View File
@@ -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
@@ -119,29 +119,20 @@ 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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeClassAttribute(github.Repository.Repository, attributes["repository"])
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 = self._makeClassAttribute(github.NotificationSubject.NotificationSubject, attributes["subject"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeDatetimeAttribute(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)
self._url = self._makeStringAttribute(attributes["url"])
+8 -12
View File
@@ -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
@@ -66,14 +66,10 @@ 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 = self._makeStringAttribute(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)
self._url = self._makeStringAttribute(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)
self._latest_comment_url = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["type"])
+58 -87
View File
@@ -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):
"""
@@ -631,89 +631,60 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Plan.Plan, attributes["plan"])
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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(attributes["url"])
+6 -9
View File
@@ -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
@@ -60,11 +60,8 @@ 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 = self._makeBoolAttribute(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 = self._makeBoolAttribute(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 = self._makeBoolAttribute(attributes["push"])
+8 -12
View File
@@ -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
@@ -68,14 +68,10 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(attributes["space"])
+68 -102
View File
@@ -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):
"""
@@ -549,104 +549,70 @@ 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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["assignee"])
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 = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["base"])
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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.PullRequestPart.PullRequestPart, attributes["head"])
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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeDatetimeAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["merged_by"])
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 = self._makeClassAttribute(github.Milestone.Milestone, attributes["milestone"])
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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+28 -42
View File
@@ -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):
"""
@@ -193,44 +193,30 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+6 -9
View File
@@ -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
@@ -61,11 +61,8 @@ 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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["sha"])
+10 -15
View File
@@ -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
@@ -79,17 +79,12 @@ class PullRequestPart(github.GithubObject.NonCompletableGithubObject):
def _useAttributes(self, attributes):
if "label" in attributes: # pragma no branch
assert attributes["label"] is None or isinstance(attributes["label"], (str, unicode)), attributes["label"]
self._label = attributes["label"]
self._label = self._makeStringAttribute(attributes["label"])
if "ref" in attributes: # pragma no branch
assert attributes["ref"] is None or isinstance(attributes["ref"], (str, unicode)), attributes["ref"]
self._ref = attributes["ref"]
self._ref = self._makeStringAttribute(attributes["ref"])
if "repo" in attributes: # pragma no branch
assert attributes["repo"] is None or isinstance(attributes["repo"], dict), attributes["repo"]
self._repo = None if attributes["repo"] is None else github.Repository.Repository(self._requester, self._headers, attributes["repo"], completed=False)
self._repo = self._makeClassAttribute(github.Repository.Repository, attributes["repo"])
if "sha" in attributes: # pragma no branch
assert attributes["sha"] is None or isinstance(attributes["sha"], (str, unicode)), attributes["sha"]
self._sha = attributes["sha"]
self._sha = self._makeStringAttribute(attributes["sha"])
if "user" in attributes: # pragma no branch
assert attributes["user"] is None or isinstance(attributes["user"], dict), attributes["user"]
self._user = None if attributes["user"] is None else github.NamedUser.NamedUser(self._requester, self._headers, attributes["user"], completed=False)
self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])
+6 -9
View File
@@ -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
@@ -58,11 +58,8 @@ 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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeTimestampAttribute(attributes["reset"])
+2 -3
View File
@@ -35,12 +35,11 @@ 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
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 = self._makeClassAttribute(github.Rate.Rate, attributes["rate"])
+144 -214
View File
@@ -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:
@@ -1960,212 +1960,142 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(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 = self._makeBoolAttribute(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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(github.Organization.Organization, attributes["organization"])
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 = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["owner"])
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 = self._makeClassAttribute(Repository, attributes["parent"])
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 = self._makeClassAttribute(github.Permissions.Permissions, attributes["permissions"])
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 = self._makeBoolAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeIntAttribute(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 = self._makeClassAttribute(Repository, attributes["source"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeIntAttribute(attributes["watchers_count"])
+10 -15
View File
@@ -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):
"""
@@ -122,17 +122,12 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(attributes["verified"])
+4 -6
View File
@@ -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
@@ -49,8 +49,6 @@ 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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(attributes["last_updated"])
+6 -9
View File
@@ -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
@@ -56,11 +56,8 @@ 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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeDatetimeAttribute(attributes["created_on"])
+8 -12
View File
@@ -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
@@ -71,14 +71,10 @@ 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 = self._makeClassAttribute(github.Commit.Commit, attributes["commit"])
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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["zipball_url"])
+18 -27
View File
@@ -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):
"""
@@ -255,29 +255,20 @@ 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 = self._makeIntAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(attributes["url"])
+10 -15
View File
@@ -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):
"""
@@ -113,17 +113,12 @@ 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 = self._makeIntAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeStringAttribute(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 = self._makeBoolAttribute(attributes["verified"])
+1 -1
View File
@@ -34,7 +34,7 @@ All classes inherit from :class:`github.GithubObject.GithubObject`.
import logging
from MainClass import Github
from GithubException import GithubException, BadCredentialsException, UnknownObjectException, BadUserAgentException, RateLimitExceededException
from GithubException import GithubException, BadCredentialsException, UnknownObjectException, BadUserAgentException, RateLimitExceededException, BadAttributeException
from InputFileContent import InputFileContent
from InputGitAuthor import InputGitAuthor
from InputGitTreeElement import InputGitTreeElement
+1
View File
@@ -70,6 +70,7 @@ from RawData import *
from ConditionalRequestUpdate import *
from Persistence import *
from ExposeAllAttributes import *
from BadAttributes import *
from Issue33 import *
from Issue50 import *
+146
View File
@@ -0,0 +1,146 @@
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# #
# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
# #
# PyGithub is free software: you can redistribute it and/or modify it under #
# the terms of the GNU Lesser General Public License as published by the Free #
# Software Foundation, either version 3 of the License, or (at your option) #
# any later version. #
# #
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
# details. #
# #
# You should have received a copy of the GNU Lesser General Public License #
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
import datetime
import Framework
import github
# Replay data is forged to simulate bad things returned by Github
class BadAttributes(Framework.TestCase):
def testBadSimpleAttribute(self):
user = self.g.get_user("klmitch")
self.assertEqual(user.created_at, datetime.datetime(2011, 3, 23, 15, 42, 9))
raised = False
try:
user.name
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, 42)
self.assertEqual(e.expected_type, (str, unicode))
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
def testBadAttributeTransformation(self):
user = self.g.get_user("klmitch")
self.assertEqual(user.name, "Kevin L. Mitchell")
raised = False
try:
user.created_at
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, "foobar")
self.assertEqual(e.expected_type, (str, unicode))
self.assertEqual(e.transformation_exception.__class__, ValueError)
self.assertEqual(e.transformation_exception.args, ("time data 'foobar' does not match format '%Y-%m-%dT%H:%M:%SZ'",))
self.assertTrue(raised)
def testBadTransformedAttribute(self):
user = self.g.get_user("klmitch")
self.assertEqual(user.name, "Kevin L. Mitchell")
raised = False
try:
user.updated_at
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, 42)
self.assertEqual(e.expected_type, (str, unicode))
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
def testBadSimpleAttributeInList(self):
hook = self.g.get_hook("activecollab")
self.assertEqual(hook.name, "activecollab")
raised = False
try:
hook.events
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, ["push", 42])
self.assertEqual(e.expected_type, [(str, unicode)])
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
def testBadAttributeInClassAttribute(self):
repo = self.g.get_repo("klmitch/turnstile")
owner = repo.owner
self.assertEqual(owner.id, 686398)
raised = False
try:
owner.avatar_url
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, 42)
self.assertTrue(raised)
def testBadTransformedAttributeInList(self):
commit = self.g.get_repo("klmitch/turnstile").get_commit("38d9082a898d0822b5ccdfd78f3a536e2efa6c26")
raised = False
try:
commit.files
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, [42])
self.assertEqual(e.expected_type, [dict])
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
def testBadTransformedAttributeInDict(self):
gist = self.g.get_gist("6437766")
raised = False
try:
gist.files
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, {"test.py": 42})
self.assertEqual(e.expected_type, {(str, unicode): dict})
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
def testIssue195(self):
hooks = self.g.get_hooks()
# We can loop on all hooks as long as we don't access circleci's events attribute
self.assertListKeyEqual(hooks, lambda h: h.name, [u'activecollab', u'acunote', u'agilebench', u'agilezen', u'amazonsns', u'apiary', u'apoio', u'appharbor', u'apropos', u'asana', u'backlog', u'bamboo', u'basecamp', u'bcx', u'blimp', u'boxcar', u'buddycloud', u'bugherd', u'bugly', u'bugzilla', u'campfire', u'cia', u'circleci', u'codeclimate', u'codeportingcsharp2java', u'codeship', u'coffeedocinfo', u'conductor', u'coop', u'copperegg', u'cube', u'depending', u'deployhq', u'devaria', u'docker', u'ducksboard', u'email', u'firebase', u'fisheye', u'flowdock', u'fogbugz', u'freckle', u'friendfeed', u'gemini', u'gemnasium', u'geocommit', u'getlocalization', u'gitlive', u'grmble', u'grouptalent', u'grove', u'habitualist', u'hakiri', u'hall', u'harvest', u'hipchat', u'hostedgraphite', u'hubcap', u'hubci', u'humbug', u'icescrum', u'irc', u'irker', u'ironmq', u'ironworker', u'jabber', u'jaconda', u'jeapie', u'jenkins', u'jenkinsgit', u'jira', u'jqueryplugins', u'kanbanery', u'kickoff', u'leanto', u'lechat', u'lighthouse', u'lingohub', u'loggly', u'mantisbt', u'masterbranch', u'mqttpub', u'nma', u'nodejitsu', u'notifo', u'ontime', u'pachube', u'packagist', u'phraseapp', u'pivotaltracker', u'planbox', u'planio', u'prowl', u'puppetlinter', u'pushalot', u'pushover', u'pythonpackages', u'railsbp', u'railsbrakeman', u'rally', u'rapidpush', u'rationaljazzhub', u'rationalteamconcert', u'rdocinfo', u'readthedocs', u'redmine', u'rubyforge', u'scrumdo', u'shiningpanda', u'sifter', u'simperium', u'slatebox', u'snowyevening', u'socialcast', u'softlayermessaging', u'sourcemint', u'splendidbacon', u'sprintly', u'sqsqueue', u'stackmob', u'statusnet', u'talker', u'targetprocess', u'tddium', u'teamcity', u'tender', u'tenxer', u'testpilot', u'toggl', u'trac', u'trajectory', u'travis', u'trello', u'twilio', u'twitter', u'unfuddle', u'web', u'weblate', u'webtranslateit', u'yammer', u'youtrack', u'zendesk', u'zohoprojects'])
for hook in hooks:
if hook.name != "circleci":
hook.events
raised = False
for hook in hooks:
if hook.name == "circleci":
try:
hook.events
except github.BadAttributeException, e:
raised = True
self.assertEqual(e.actual_value, [["commit_comment", "create", "delete", "download", "follow", "fork", "fork_apply", "gist", "gollum", "issue_comment", "issues", "member", "public", "pull_request", "pull_request_review_comment", "push", "status", "team_add", "watch"]])
self.assertEqual(e.expected_type, [(str, unicode)])
self.assertIsNone(e.transformation_exception)
self.assertTrue(raised)
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/repos/klmitch/turnstile
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4968'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', '5351c17d-c8ac-4a49-b6f4-1dd0411bb9ae'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '4587'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 21 Aug 2013 16:04:54 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"aab62d006633c3842d38e20dc732a2c9"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 08:38:57 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378976739')]
{"id":3404510,"name":"turnstile","full_name":"klmitch/turnstile","owner":{"login":"klmitch","id":686398,"avatar_url":42,"gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User"},"private":false,"html_url":"https://github.com/klmitch/turnstile","description":"A distributed rate limiting WSGI middleware.","fork":false,"url":"https://api.github.com/repos/klmitch/turnstile","forks_url":"https://api.github.com/repos/klmitch/turnstile/forks","keys_url":"https://api.github.com/repos/klmitch/turnstile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klmitch/turnstile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klmitch/turnstile/teams","hooks_url":"https://api.github.com/repos/klmitch/turnstile/hooks","issue_events_url":"https://api.github.com/repos/klmitch/turnstile/issues/events{/number}","events_url":"https://api.github.com/repos/klmitch/turnstile/events","assignees_url":"https://api.github.com/repos/klmitch/turnstile/assignees{/user}","branches_url":"https://api.github.com/repos/klmitch/turnstile/branches{/branch}","tags_url":"https://api.github.com/repos/klmitch/turnstile/tags","blobs_url":"https://api.github.com/repos/klmitch/turnstile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klmitch/turnstile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klmitch/turnstile/git/refs{/sha}","trees_url":"https://api.github.com/repos/klmitch/turnstile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klmitch/turnstile/statuses/{sha}","languages_url":"https://api.github.com/repos/klmitch/turnstile/languages","stargazers_url":"https://api.github.com/repos/klmitch/turnstile/stargazers","contributors_url":"https://api.github.com/repos/klmitch/turnstile/contributors","subscribers_url":"https://api.github.com/repos/klmitch/turnstile/subscribers","subscription_url":"https://api.github.com/repos/klmitch/turnstile/subscription","commits_url":"https://api.github.com/repos/klmitch/turnstile/commits{/sha}","git_commits_url":"https://api.github.com/repos/klmitch/turnstile/git/commits{/sha}","comments_url":"https://api.github.com/repos/klmitch/turnstile/comments{/number}","issue_comment_url":"https://api.github.com/repos/klmitch/turnstile/issues/comments/{number}","contents_url":"https://api.github.com/repos/klmitch/turnstile/contents/{+path}","compare_url":"https://api.github.com/repos/klmitch/turnstile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klmitch/turnstile/merges","archive_url":"https://api.github.com/repos/klmitch/turnstile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klmitch/turnstile/downloads","issues_url":"https://api.github.com/repos/klmitch/turnstile/issues{/number}","pulls_url":"https://api.github.com/repos/klmitch/turnstile/pulls{/number}","milestones_url":"https://api.github.com/repos/klmitch/turnstile/milestones{/number}","notifications_url":"https://api.github.com/repos/klmitch/turnstile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klmitch/turnstile/labels{/name}","created_at":"2012-02-10T05:16:36Z","updated_at":"2013-08-21T16:04:54Z","pushed_at":"2013-05-01T22:22:20Z","git_url":"git://github.com/klmitch/turnstile.git","ssh_url":"git@github.com:klmitch/turnstile.git","clone_url":"https://github.com/klmitch/turnstile.git","svn_url":"https://github.com/klmitch/turnstile","homepage":"","size":260,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":15,"master_branch":"master","default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"network_count":6}
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/users/klmitch
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', 'b66ca3c7-84f9-455a-9db8-3df385fc7b32'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '1254'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 11 Sep 2013 19:26:25 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"6c1c41cdc34b6a47b3ee2a765cc51310"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 08:45:34 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378976739')]
{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User","name":"Kevin L. Mitchell","company":"Rackspace","blog":null,"location":"San Antonio, TX","email":"kevin.mitchell@rackspace.com","hireable":false,"bio":null,"public_repos":29,"followers":15,"following":18,"created_at":"foobar","updated_at":42,"public_gists":0}
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/users/klmitch
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4970'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', '678fcfc5-140a-4d38-be2f-09ebbd8bb58d'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '1254'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 11 Sep 2013 19:26:25 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"6c1c41cdc34b6a47b3ee2a765cc51310"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 08:21:32 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378976739')]
{"login":"klmitch","id":686398,"avatar_url":"https://2.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User","name":42,"company":"Rackspace","blog":null,"location":"San Antonio, TX","email":"kevin.mitchell@rackspace.com","hireable":false,"bio":null,"public_repos":29,"followers":15,"following":18,"created_at":"2011-03-23T15:42:09Z","updated_at":"2013-09-11T19:26:25Z","public_gists":0}
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/hooks/activecollab
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4969'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', 'fd44f8b6-d47d-44c5-a365-cd7bf9569c88'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '191'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 04 Sep 2013 18:03:57 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"678dd8e392d70d3a284c3d47221ec6f0"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 08:31:46 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378976739')]
{"name":"activecollab","events":["push", 42],"supported_events":["push"],"schema":[["string","url"],["string","token"],["string","project_id"],["string","milestone_id"],["string","category_id"]]}
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/users/klmitch
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4966'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', 'b66ca3c7-84f9-455a-9db8-3df385fc7b32'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '1254'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 11 Sep 2013 19:26:25 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"6c1c41cdc34b6a47b3ee2a765cc51310"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 08:45:34 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378976739')]
{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User","name":"Kevin L. Mitchell","company":"Rackspace","blog":null,"location":"San Antonio, TX","email":"kevin.mitchell@rackspace.com","hireable":false,"bio":null,"public_repos":29,"followers":15,"following":18,"created_at":"foobar","updated_at":42,"public_gists":0}
@@ -0,0 +1,11 @@
https
GET
api.github.com
None
/gists/6437766
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4996'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', '8131a430-28c1-45bb-a5b7-09fcdabc5dc7'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '2933'), ('server', 'GitHub.com'), ('last-modified', 'Thu, 12 Sep 2013 00:23:35 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"b3954ac942969f1e10c24ec5b5ec04d3"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 09:25:36 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378980564')]
{"url":"https://api.github.com/gists/6437766","forks_url":"https://api.github.com/gists/6437766/forks","commits_url":"https://api.github.com/gists/6437766/commits","id":"6437766","git_pull_url":"https://gist.github.com/6437766.git","git_push_url":"https://gist.github.com/6437766.git","html_url":"https://gist.github.com/6437766","files":{"test.py":42},"public":true,"created_at":"2013-09-04T14:30:47Z","updated_at":"2013-09-04T14:30:48Z","description":"Test script for https://github.com/jacquev6/PyGithub/issues/194","comments":0,"user":{"login":"jacquev6","id":327146,"avatar_url":"https://1.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https%3A%2F%2Fidenticons.github.com%2Ffadfb5f7088ef66579d198a3c9a4935e.png","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","url":"https://api.github.com/users/jacquev6","html_url":"https://github.com/jacquev6","followers_url":"https://api.github.com/users/jacquev6/followers","following_url":"https://api.github.com/users/jacquev6/following{/other_user}","gists_url":"https://api.github.com/users/jacquev6/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquev6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquev6/subscriptions","organizations_url":"https://api.github.com/users/jacquev6/orgs","repos_url":"https://api.github.com/users/jacquev6/repos","events_url":"https://api.github.com/users/jacquev6/events{/privacy}","received_events_url":"https://api.github.com/users/jacquev6/received_events","type":"User"},"comments_url":"https://api.github.com/gists/6437766/comments","forks":[],"history":[{"user":null,"version":"5aa7a28e0a1dc6acf5a70de66e189f73f01735f4","committed_at":"2013-09-04T14:30:47Z","change_status":{"total":24,"additions":24,"deletions":0},"url":"https://api.github.com/gists/6437766/5aa7a28e0a1dc6acf5a70de66e189f73f01735f4"}]}
@@ -0,0 +1,22 @@
https
GET
api.github.com
None
/repos/klmitch/turnstile
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4999'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', 'b9d67757-009d-4a30-9854-f41e04681849'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '4587'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 21 Aug 2013 16:04:54 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"aab62d006633c3842d38e20dc732a2c9"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 09:09:24 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378980564')]
{"id":3404510,"name":"turnstile","full_name":"klmitch/turnstile","owner":{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User"},"private":false,"html_url":"https://github.com/klmitch/turnstile","description":"A distributed rate limiting WSGI middleware.","fork":false,"url":"https://api.github.com/repos/klmitch/turnstile","forks_url":"https://api.github.com/repos/klmitch/turnstile/forks","keys_url":"https://api.github.com/repos/klmitch/turnstile/keys{/key_id}","collaborators_url":"https://api.github.com/repos/klmitch/turnstile/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/klmitch/turnstile/teams","hooks_url":"https://api.github.com/repos/klmitch/turnstile/hooks","issue_events_url":"https://api.github.com/repos/klmitch/turnstile/issues/events{/number}","events_url":"https://api.github.com/repos/klmitch/turnstile/events","assignees_url":"https://api.github.com/repos/klmitch/turnstile/assignees{/user}","branches_url":"https://api.github.com/repos/klmitch/turnstile/branches{/branch}","tags_url":"https://api.github.com/repos/klmitch/turnstile/tags","blobs_url":"https://api.github.com/repos/klmitch/turnstile/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/klmitch/turnstile/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/klmitch/turnstile/git/refs{/sha}","trees_url":"https://api.github.com/repos/klmitch/turnstile/git/trees{/sha}","statuses_url":"https://api.github.com/repos/klmitch/turnstile/statuses/{sha}","languages_url":"https://api.github.com/repos/klmitch/turnstile/languages","stargazers_url":"https://api.github.com/repos/klmitch/turnstile/stargazers","contributors_url":"https://api.github.com/repos/klmitch/turnstile/contributors","subscribers_url":"https://api.github.com/repos/klmitch/turnstile/subscribers","subscription_url":"https://api.github.com/repos/klmitch/turnstile/subscription","commits_url":"https://api.github.com/repos/klmitch/turnstile/commits{/sha}","git_commits_url":"https://api.github.com/repos/klmitch/turnstile/git/commits{/sha}","comments_url":"https://api.github.com/repos/klmitch/turnstile/comments{/number}","issue_comment_url":"https://api.github.com/repos/klmitch/turnstile/issues/comments/{number}","contents_url":"https://api.github.com/repos/klmitch/turnstile/contents/{+path}","compare_url":"https://api.github.com/repos/klmitch/turnstile/compare/{base}...{head}","merges_url":"https://api.github.com/repos/klmitch/turnstile/merges","archive_url":"https://api.github.com/repos/klmitch/turnstile/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/klmitch/turnstile/downloads","issues_url":"https://api.github.com/repos/klmitch/turnstile/issues{/number}","pulls_url":"https://api.github.com/repos/klmitch/turnstile/pulls{/number}","milestones_url":"https://api.github.com/repos/klmitch/turnstile/milestones{/number}","notifications_url":"https://api.github.com/repos/klmitch/turnstile/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/klmitch/turnstile/labels{/name}","created_at":"2012-02-10T05:16:36Z","updated_at":"2013-08-21T16:04:54Z","pushed_at":"2013-05-01T22:22:20Z","git_url":"git://github.com/klmitch/turnstile.git","ssh_url":"git@github.com:klmitch/turnstile.git","clone_url":"https://github.com/klmitch/turnstile.git","svn_url":"https://github.com/klmitch/turnstile","homepage":"","size":260,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":15,"master_branch":"master","default_branch":"master","permissions":{"admin":false,"push":false,"pull":true},"network_count":6}
https
GET
api.github.com
None
/repos/klmitch/turnstile/commits/38d9082a898d0822b5ccdfd78f3a536e2efa6c26
{'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
null
200
[('status', '200 OK'), ('x-ratelimit-remaining', '4998'), ('x-github-media-type', 'github.beta; format=json'), ('x-content-type-options', 'nosniff'), ('access-control-expose-headers', 'ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes'), ('x-github-request-id', '205eb9ed-a173-47a2-b670-16ec266adef5'), ('access-control-allow-credentials', 'true'), ('vary', 'Accept, Authorization, Cookie, Accept-Encoding'), ('content-length', '6111'), ('server', 'GitHub.com'), ('last-modified', 'Wed, 01 May 2013 19:03:50 GMT'), ('x-ratelimit-limit', '5000'), ('etag', '"50a14a79f7095a8d4fed16d05a4b1412"'), ('cache-control', 'private, max-age=60, s-maxage=60'), ('date', 'Thu, 12 Sep 2013 09:09:25 GMT'), ('access-control-allow-origin', '*'), ('content-type', 'application/json; charset=utf-8'), ('x-ratelimit-reset', '1378980564')]
{"sha":"38d9082a898d0822b5ccdfd78f3a536e2efa6c26","commit":{"author":{"name":"Kevin L. Mitchell","email":"kevin.mitchell@rackspace.com","date":"2013-05-01T19:03:50Z"},"committer":{"name":"Kevin L. Mitchell","email":"kevin.mitchell@rackspace.com","date":"2013-05-01T19:03:50Z"},"message":"Ignore empty configuration values for extra database arguments\n\nTurnstile's functionality to allow the control daemon and the\ncompactor daemon to use different Redis configuration provides\none problem: values that are set in the \"[redis]\" section are\ninherited by all sections, even when that is not desired. To\ncombat this, we now allow an empty value to completely delete\nthe key from the redis configuration in Config.get_database().","tree":{"sha":"83b8ab73bedb67846b47533d1bac7767ac325dc8","url":"https://api.github.com/repos/klmitch/turnstile/git/trees/83b8ab73bedb67846b47533d1bac7767ac325dc8"},"url":"https://api.github.com/repos/klmitch/turnstile/git/commits/38d9082a898d0822b5ccdfd78f3a536e2efa6c26","comment_count":0},"url":"https://api.github.com/repos/klmitch/turnstile/commits/38d9082a898d0822b5ccdfd78f3a536e2efa6c26","html_url":"https://github.com/klmitch/turnstile/commit/38d9082a898d0822b5ccdfd78f3a536e2efa6c26","comments_url":"https://api.github.com/repos/klmitch/turnstile/commits/38d9082a898d0822b5ccdfd78f3a536e2efa6c26/comments","author":{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User"},"committer":{"login":"klmitch","id":686398,"avatar_url":"https://1.gravatar.com/avatar/3c505225c6f28a7702b318a991141495?d=https%3A%2F%2Fidenticons.github.com%2Ffffa0f2e30bad5753edbb60f250b7cbe.png","gravatar_id":"3c505225c6f28a7702b318a991141495","url":"https://api.github.com/users/klmitch","html_url":"https://github.com/klmitch","followers_url":"https://api.github.com/users/klmitch/followers","following_url":"https://api.github.com/users/klmitch/following{/other_user}","gists_url":"https://api.github.com/users/klmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/klmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmitch/subscriptions","organizations_url":"https://api.github.com/users/klmitch/orgs","repos_url":"https://api.github.com/users/klmitch/repos","events_url":"https://api.github.com/users/klmitch/events{/privacy}","received_events_url":"https://api.github.com/users/klmitch/received_events","type":"User"},"parents":[{"sha":"e649bcaa580248de40ef6c126fe446a3da514312","url":"https://api.github.com/repos/klmitch/turnstile/commits/e649bcaa580248de40ef6c126fe446a3da514312","html_url":"https://github.com/klmitch/turnstile/commit/e649bcaa580248de40ef6c126fe446a3da514312"}],"stats":{"total":9,"additions":7,"deletions":2},"files":[42]}
File diff suppressed because one or more lines are too long