Merge branch 'topic/GitAuthorDateAsDatetime' into develop

This commit is contained in:
Vincent Jacques
2012-07-13 21:14:51 +02:00
28 changed files with 137 additions and 107 deletions
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -619,7 +617,7 @@ class AuthenticatedUser( GithubObject.GithubObject ):
self._company = 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 = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "disk_usage" in attributes: # pragma no branch
assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
self._disk_usage = attributes[ "disk_usage" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import AuthorizationApplication
@@ -116,7 +114,7 @@ class Authorization( GithubObject.GithubObject ):
self._app = None if attributes[ "app" ] is None else AuthorizationApplication.AuthorizationApplication( self._requester, attributes[ "app" ], completed = False )
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
@@ -134,7 +132,7 @@ class Authorization( GithubObject.GithubObject ):
self._token = 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 = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import NamedUser
@@ -119,7 +117,7 @@ class CommitComment( GithubObject.GithubObject ):
self._commit_id = attributes[ "commit_id" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "html_url" in attributes: # pragma no branch
assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
self._html_url = attributes[ "html_url" ]
@@ -137,7 +135,7 @@ class CommitComment( GithubObject.GithubObject ):
self._position = attributes[ "position" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
class Download( GithubObject.GithubObject ):
@@ -164,7 +162,7 @@ class Download( GithubObject.GithubObject ):
self._content_type = 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 = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "description" in attributes: # pragma no branch
assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
self._description = attributes[ "description" ]
@@ -173,7 +171,7 @@ class Download( GithubObject.GithubObject ):
self._download_count = 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 = None if attributes[ "expirationdate" ] is None else datetime.datetime.strptime( attributes[ "expirationdate" ], "%Y-%m-%dT%H:%M:%S.000Z" )
self._expirationdate = self._parseDatetime( attributes[ "expirationdate" ] )
if "html_url" in attributes: # pragma no branch
assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
self._html_url = attributes[ "html_url" ]
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import Organization
@@ -71,7 +69,7 @@ class Event( GithubObject.BasicGithubObject ):
self._actor = None if attributes[ "actor" ] is None else NamedUser.NamedUser( self._requester, attributes[ "actor" ], completed = False )
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], ( str, unicode ) ), attributes[ "id" ]
self._id = attributes[ "id" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -220,7 +218,7 @@ class Gist( GithubObject.GithubObject ):
self._comments = attributes[ "comments" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "description" in attributes: # pragma no branch
assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
self._description = attributes[ "description" ]
@@ -262,7 +260,7 @@ class Gist( GithubObject.GithubObject ):
self._public = attributes[ "public" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import NamedUser
@@ -86,13 +84,13 @@ class GistComment( GithubObject.GithubObject ):
self._body = attributes[ "body" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import NamedUser
@@ -60,7 +58,7 @@ class GistHistoryState( GithubObject.GithubObject ):
self._change_status = None if attributes[ "change_status" ] is None else CommitStats.CommitStats( self._requester, attributes[ "change_status" ], completed = False )
if "committed_at" in attributes: # pragma no branch
assert attributes[ "committed_at" ] is None or isinstance( attributes[ "committed_at" ], ( str, unicode ) ), attributes[ "committed_at" ]
self._committed_at = None if attributes[ "committed_at" ] is None else datetime.datetime.strptime( attributes[ "committed_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._committed_at = self._parseDatetime( attributes[ "committed_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" ]
+1 -1
View File
@@ -37,7 +37,7 @@ class GitAuthor( GithubObject.BasicGithubObject ):
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 = attributes[ "date" ]
self._date = self._parseDatetime( attributes[ "date" ] )
if "email" in attributes: # pragma no branch
assert attributes[ "email" ] is None or isinstance( attributes[ "email" ], ( str, unicode ) ), attributes[ "email" ]
self._email = attributes[ "email" ]
+13
View File
@@ -11,6 +11,8 @@
# 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 GithubException
class _NotSetType:
@@ -34,6 +36,17 @@ class BasicGithubObject( object ):
else:
return value
@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 ] ) )
else:
return datetime.datetime.strptime( s, "%Y-%m-%dT%H:%M:%SZ" )
class GithubObject( BasicGithubObject ):
def __init__( self, requester, attributes, completed ):
BasicGithubObject.__init__( self, requester, attributes, completed )
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import HookResponse
@@ -129,7 +127,7 @@ class Hook( GithubObject.GithubObject ):
self._config = 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 = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "events" in attributes: # pragma no branch
assert attributes[ "events" ] is None or all( isinstance( element, ( str, unicode ) ) for element in attributes[ "events" ] ), attributes[ "events" ]
self._events = attributes[ "events" ]
@@ -144,7 +142,7 @@ class Hook( GithubObject.GithubObject ):
self._name = attributes[ "name" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+3 -5
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -281,7 +279,7 @@ class Issue( GithubObject.GithubObject ):
self._body = attributes[ "body" ]
if "closed_at" in attributes: # pragma no branch
assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
self._closed_at = None if attributes[ "closed_at" ] is None else datetime.datetime.strptime( attributes[ "closed_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._closed_at = self._parseDatetime( attributes[ "closed_at" ] )
if "closed_by" in attributes: # pragma no branch
assert attributes[ "closed_by" ] is None or isinstance( attributes[ "closed_by" ], dict ), attributes[ "closed_by" ]
self._closed_by = None if attributes[ "closed_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "closed_by" ], completed = False )
@@ -290,7 +288,7 @@ class Issue( GithubObject.GithubObject ):
self._comments = attributes[ "comments" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "html_url" in attributes: # pragma no branch
assert attributes[ "html_url" ] is None or isinstance( attributes[ "html_url" ], ( str, unicode ) ), attributes[ "html_url" ]
self._html_url = attributes[ "html_url" ]
@@ -323,7 +321,7 @@ class Issue( GithubObject.GithubObject ):
self._title = attributes[ "title" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import NamedUser
@@ -86,13 +84,13 @@ class IssueComment( GithubObject.GithubObject ):
self._body = attributes[ "body" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import Issue
@@ -75,7 +73,7 @@ class IssueEvent( GithubObject.GithubObject ):
self._commit_id = attributes[ "commit_id" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "event" in attributes: # pragma no branch
assert attributes[ "event" ] is None or isinstance( attributes[ "event" ], ( str, unicode ) ), attributes[ "event" ]
self._event = attributes[ "event" ]
+2 -2
View File
@@ -145,7 +145,7 @@ class Milestone( GithubObject.GithubObject ):
self._closed_issues = attributes[ "closed_issues" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "creator" in attributes: # pragma no branch
assert attributes[ "creator" ] is None or isinstance( attributes[ "creator" ], dict ), attributes[ "creator" ]
self._creator = None if attributes[ "creator" ] is None else NamedUser.NamedUser( self._requester, attributes[ "creator" ], completed = False )
@@ -154,7 +154,7 @@ class Milestone( GithubObject.GithubObject ):
self._description = attributes[ "description" ]
if "due_on" in attributes: # pragma no branch
assert attributes[ "due_on" ] is None or isinstance( attributes[ "due_on" ], ( str, unicode ) ), attributes[ "due_on" ]
self._due_on = None if attributes[ "due_on" ] is None else datetime.datetime.strptime( attributes[ "due_on" ], "%Y-%m-%dT%H:%M:%SZ" )
self._due_on = self._parseDatetime( attributes[ "due_on" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -383,7 +381,7 @@ class NamedUser( GithubObject.GithubObject ):
self._contributions = 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 = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "disk_usage" in attributes: # pragma no branch
assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
self._disk_usage = attributes[ "disk_usage" ]
+1 -3
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -425,7 +423,7 @@ class Organization( GithubObject.GithubObject ):
self._company = 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 = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "disk_usage" in attributes: # pragma no branch
assert attributes[ "disk_usage" ] is None or isinstance( attributes[ "disk_usage" ], int ), attributes[ "disk_usage" ]
self._disk_usage = attributes[ "disk_usage" ]
+4 -6
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import PaginatedList
@@ -312,7 +310,7 @@ class PullRequest( GithubObject.GithubObject ):
self._changed_files = attributes[ "changed_files" ]
if "closed_at" in attributes: # pragma no branch
assert attributes[ "closed_at" ] is None or isinstance( attributes[ "closed_at" ], ( str, unicode ) ), attributes[ "closed_at" ]
self._closed_at = None if attributes[ "closed_at" ] is None else datetime.datetime.strptime( attributes[ "closed_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._closed_at = self._parseDatetime( attributes[ "closed_at" ] )
if "comments" in attributes: # pragma no branch
assert attributes[ "comments" ] is None or isinstance( attributes[ "comments" ], int ), attributes[ "comments" ]
self._comments = attributes[ "comments" ]
@@ -321,7 +319,7 @@ class PullRequest( GithubObject.GithubObject ):
self._commits = attributes[ "commits" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "deletions" in attributes: # pragma no branch
assert attributes[ "deletions" ] is None or isinstance( attributes[ "deletions" ], int ), attributes[ "deletions" ]
self._deletions = attributes[ "deletions" ]
@@ -348,7 +346,7 @@ class PullRequest( GithubObject.GithubObject ):
self._merged = attributes[ "merged" ]
if "merged_at" in attributes: # pragma no branch
assert attributes[ "merged_at" ] is None or isinstance( attributes[ "merged_at" ], ( str, unicode ) ), attributes[ "merged_at" ]
self._merged_at = None if attributes[ "merged_at" ] is None else datetime.datetime.strptime( attributes[ "merged_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._merged_at = self._parseDatetime( attributes[ "merged_at" ] )
if "merged_by" in attributes: # pragma no branch
assert attributes[ "merged_by" ] is None or isinstance( attributes[ "merged_by" ], dict ), attributes[ "merged_by" ]
self._merged_by = None if attributes[ "merged_by" ] is None else NamedUser.NamedUser( self._requester, attributes[ "merged_by" ], completed = False )
@@ -369,7 +367,7 @@ class PullRequest( GithubObject.GithubObject ):
self._title = attributes[ "title" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+2 -4
View File
@@ -14,8 +14,6 @@
# 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 GithubObject
import NamedUser
@@ -119,7 +117,7 @@ class PullRequestComment( GithubObject.GithubObject ):
self._commit_id = attributes[ "commit_id" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "id" in attributes: # pragma no branch
assert attributes[ "id" ] is None or isinstance( attributes[ "id" ], int ), attributes[ "id" ]
self._id = attributes[ "id" ]
@@ -137,7 +135,7 @@ class PullRequestComment( GithubObject.GithubObject ):
self._position = attributes[ "position" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]
+3 -3
View File
@@ -1059,7 +1059,7 @@ class Repository( GithubObject.GithubObject ):
self._clone_url = attributes[ "clone_url" ]
if "created_at" in attributes: # pragma no branch
assert attributes[ "created_at" ] is None or isinstance( attributes[ "created_at" ], ( str, unicode ) ), attributes[ "created_at" ]
self._created_at = None if attributes[ "created_at" ] is None else datetime.datetime.strptime( attributes[ "created_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._created_at = self._parseDatetime( attributes[ "created_at" ] )
if "description" in attributes: # pragma no branch
assert attributes[ "description" ] is None or isinstance( attributes[ "description" ], ( str, unicode ) ), attributes[ "description" ]
self._description = attributes[ "description" ]
@@ -1122,7 +1122,7 @@ class Repository( GithubObject.GithubObject ):
self._private = attributes[ "private" ]
if "pushed_at" in attributes: # pragma no branch
assert attributes[ "pushed_at" ] is None or isinstance( attributes[ "pushed_at" ], ( str, unicode ) ), attributes[ "pushed_at" ]
self._pushed_at = None if attributes[ "pushed_at" ] is None else datetime.datetime.strptime( attributes[ "pushed_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._pushed_at = self._parseDatetime( attributes[ "pushed_at" ] )
if "size" in attributes: # pragma no branch
assert attributes[ "size" ] is None or isinstance( attributes[ "size" ], int ), attributes[ "size" ]
self._size = attributes[ "size" ]
@@ -1137,7 +1137,7 @@ class Repository( GithubObject.GithubObject ):
self._svn_url = attributes[ "svn_url" ]
if "updated_at" in attributes: # pragma no branch
assert attributes[ "updated_at" ] is None or isinstance( attributes[ "updated_at" ], ( str, unicode ) ), attributes[ "updated_at" ]
self._updated_at = None if attributes[ "updated_at" ] is None else datetime.datetime.strptime( attributes[ "updated_at" ], "%Y-%m-%dT%H:%M:%SZ" )
self._updated_at = self._parseDatetime( attributes[ "updated_at" ] )
if "url" in attributes: # pragma no branch
assert attributes[ "url" ] is None or isinstance( attributes[ "url" ], ( str, unicode ) ), attributes[ "url" ]
self._url = attributes[ "url" ]