mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Merge branch 'topic/GitAuthorDateAsDatetime' into develop
This commit is contained in:
@@ -1 +1 @@
|
||||
{% if attribute.type.name == "datetime" %}None if attributes[ "{{ attribute.name }}" ] is None else datetime.datetime.strptime( attributes[ "{{ attribute.name }}" ], "%Y-%m-%dT%H:%M:%SZ" ){% else %}attributes[ "{{ attribute.name }}" ]{% endif %}
|
||||
{% if attribute.type.name == "datetime" %}self._parseDatetime( attributes[ "{{ attribute.name }}" ] ){% else %}attributes[ "{{ attribute.name }}" ]{% endif %}
|
||||
+36
-36
@@ -59,7 +59,7 @@ Attributes
|
||||
* `blog`: string
|
||||
* `collaborators`: integer
|
||||
* `company`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `disk_usage`: integer
|
||||
* `email`: string
|
||||
* `followers`: integer
|
||||
@@ -193,13 +193,13 @@ Class `Authorization`
|
||||
Attributes
|
||||
----------
|
||||
* `app`: `AuthorizationApplication`
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `id`: integer
|
||||
* `note`: string
|
||||
* `note_url`: string
|
||||
* `scopes`: list of string
|
||||
* `token`: string
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
|
||||
Deletion
|
||||
@@ -261,13 +261,13 @@ Attributes
|
||||
----------
|
||||
* `body`: string
|
||||
* `commit_id`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `html_url`: string
|
||||
* `id`: integer
|
||||
* `line`: integer
|
||||
* `path`: string
|
||||
* `position`: integer
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -316,10 +316,10 @@ Attributes
|
||||
* `acl`: string
|
||||
* `bucket`: string
|
||||
* `content_type`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `description`: string
|
||||
* `download_count`: integer
|
||||
* `expirationdate`: datetime
|
||||
* `expirationdate`: datetime.datetime
|
||||
* `html_url`: string
|
||||
* `id`: integer
|
||||
* `mime_type`: string
|
||||
@@ -343,7 +343,7 @@ Class `Event`
|
||||
Attributes
|
||||
----------
|
||||
* `actor`: `NamedUser`
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `id`: string
|
||||
* `org`: `Organization`
|
||||
* `payload`: dict
|
||||
@@ -372,7 +372,7 @@ Class `Gist`
|
||||
Attributes
|
||||
----------
|
||||
* `comments`: integer
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `description`: string
|
||||
* `files`: dict of string to `GistFile`
|
||||
* `fork_of`: `Gist`
|
||||
@@ -383,7 +383,7 @@ Attributes
|
||||
* `html_url`: string
|
||||
* `id`: string
|
||||
* `public`: bool
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -421,9 +421,9 @@ Class `GistComment`
|
||||
Attributes
|
||||
----------
|
||||
* `body`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `id`: integer
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -453,7 +453,7 @@ Class `GistHistoryState`
|
||||
Attributes
|
||||
----------
|
||||
* `change_status`: `CommitStats`
|
||||
* `committed_at`: datetime
|
||||
* `committed_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
* `version`: string
|
||||
@@ -463,7 +463,7 @@ Class `GitAuthor`
|
||||
|
||||
Attributes
|
||||
----------
|
||||
* `date`: string
|
||||
* `date`: datetime.datetime
|
||||
* `email`: string
|
||||
* `name`: string
|
||||
|
||||
@@ -559,12 +559,12 @@ Attributes
|
||||
----------
|
||||
* `active`: bool
|
||||
* `config`: dict
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `events`: list of string
|
||||
* `id`: integer
|
||||
* `last_response`: `HookResponse`
|
||||
* `name`: string
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
|
||||
Deletion
|
||||
@@ -601,10 +601,10 @@ Attributes
|
||||
----------
|
||||
* `assignee`: `NamedUser`
|
||||
* `body`: string
|
||||
* `closed_at`: datetime
|
||||
* `closed_at`: datetime.datetime
|
||||
* `closed_by`: `NamedUser`
|
||||
* `comments`: integer
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `html_url`: string
|
||||
* `id`: integer
|
||||
* `labels`: list of `Label`
|
||||
@@ -614,7 +614,7 @@ Attributes
|
||||
* `repository`: `Repository`
|
||||
* `state`: string
|
||||
* `title`: string
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -657,9 +657,9 @@ Class `IssueComment`
|
||||
Attributes
|
||||
----------
|
||||
* `body`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `id`: integer
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -679,7 +679,7 @@ Attributes
|
||||
----------
|
||||
* `actor`: `NamedUser`
|
||||
* `commit_id`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `event`: string
|
||||
* `id`: integer
|
||||
* `issue`: `Issue`
|
||||
@@ -719,10 +719,10 @@ Class `Milestone`
|
||||
Attributes
|
||||
----------
|
||||
* `closed_issues`: integer
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `creator`: `NamedUser`
|
||||
* `description`: string
|
||||
* `due_on`: datetime
|
||||
* `due_on`: datetime.datetime
|
||||
* `id`: integer
|
||||
* `number`: integer
|
||||
* `open_issues`: integer
|
||||
@@ -757,7 +757,7 @@ Attributes
|
||||
* `collaborators`: integer
|
||||
* `company`: string
|
||||
* `contributions`: integer
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `disk_usage`: integer
|
||||
* `email`: string
|
||||
* `followers`: integer
|
||||
@@ -826,7 +826,7 @@ Attributes
|
||||
* `blog`: string
|
||||
* `collaborators`: integer
|
||||
* `company`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `disk_usage`: integer
|
||||
* `email`: string
|
||||
* `followers`: integer
|
||||
@@ -937,10 +937,10 @@ Attributes
|
||||
* `base`: `PullRequestPart`
|
||||
* `body`: string
|
||||
* `changed_files`: integer
|
||||
* `closed_at`: datetime
|
||||
* `closed_at`: datetime.datetime
|
||||
* `comments`: integer
|
||||
* `commits`: integer
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `deletions`: integer
|
||||
* `diff_url`: string
|
||||
* `head`: `PullRequestPart`
|
||||
@@ -949,14 +949,14 @@ Attributes
|
||||
* `issue_url`: string
|
||||
* `mergeable`: bool
|
||||
* `merged`: bool
|
||||
* `merged_at`: datetime
|
||||
* `merged_at`: datetime.datetime
|
||||
* `merged_by`: `NamedUser`
|
||||
* `number`: integer
|
||||
* `patch_url`: string
|
||||
* `review_comments`: integer
|
||||
* `state`: string
|
||||
* `title`: string
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -999,13 +999,13 @@ Attributes
|
||||
----------
|
||||
* `body`: string
|
||||
* `commit_id`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `id`: integer
|
||||
* `original_commit_id`: string
|
||||
* `original_position`: integer
|
||||
* `path`: string
|
||||
* `position`: integer
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `user`: `NamedUser`
|
||||
|
||||
@@ -1044,7 +1044,7 @@ Class `Repository`
|
||||
Attributes
|
||||
----------
|
||||
* `clone_url`: string
|
||||
* `created_at`: datetime
|
||||
* `created_at`: datetime.datetime
|
||||
* `description`: string
|
||||
* `fork`: bool
|
||||
* `forks`: integer
|
||||
@@ -1065,12 +1065,12 @@ Attributes
|
||||
* `parent`: `Repository`
|
||||
* `permissions`: `Permissions`
|
||||
* `private`: bool
|
||||
* `pushed_at`: datetime
|
||||
* `pushed_at`: datetime.datetime
|
||||
* `size`: integer
|
||||
* `source`: `Repository`
|
||||
* `ssh_url`: string
|
||||
* `svn_url`: string
|
||||
* `updated_at`: datetime
|
||||
* `updated_at`: datetime.datetime
|
||||
* `url`: string
|
||||
* `watchers`: integer
|
||||
|
||||
@@ -1209,7 +1209,7 @@ Issues
|
||||
* `labels`: list of `Label`
|
||||
* `sort`: string
|
||||
* `direction`: string
|
||||
* `since`: datetime
|
||||
* `since`: datetime.datetime
|
||||
* `legacy_search_issues( state, keyword )`: iterator of `Issue`
|
||||
* `state`: "open" or "closed"
|
||||
* `keyword`: string
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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
@@ -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" ]
|
||||
|
||||
@@ -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
@@ -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
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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
@@ -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
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
+6
-2
@@ -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 Framework
|
||||
|
||||
class GitCommit( Framework.TestCase ):
|
||||
@@ -21,10 +23,12 @@ class GitCommit( Framework.TestCase ):
|
||||
def testAttributes( self ):
|
||||
self.assertEqual( self.commit.author.name, "Vincent Jacques" )
|
||||
self.assertEqual( self.commit.author.email, "vincent@vincent-jacques.net" )
|
||||
self.assertEqual( self.commit.author.date, "2012-04-17T10:55:16-07:00" )
|
||||
self.assertEqual( self.commit.author.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) )
|
||||
self.assertEqual( self.commit.author.timezone, datetime.timedelta( hours = -7 ) )
|
||||
self.assertEqual( self.commit.committer.name, "Vincent Jacques" )
|
||||
self.assertEqual( self.commit.committer.email, "vincent@vincent-jacques.net" )
|
||||
self.assertEqual( self.commit.committer.date, "2012-04-17T10:55:16-07:00" )
|
||||
self.assertEqual( self.commit.committer.date, datetime.datetime( 2012, 4, 17, 10, 55, 16 ) )
|
||||
self.assertEqual( self.commit.committer.timezone, datetime.timedelta( hours = -7 ) )
|
||||
self.assertEqual( self.commit.message, "Merge branch 'develop'\n" )
|
||||
self.assertEqual( len( self.commit.parents ), 2 )
|
||||
self.assertEqual( self.commit.parents[ 0 ].sha, "936f4a97f1a86392637ec002bbf89ff036a5062d" )
|
||||
|
||||
+4
-1
@@ -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 Framework
|
||||
|
||||
class GitTag( Framework.TestCase ):
|
||||
@@ -25,7 +27,8 @@ class GitTag( Framework.TestCase ):
|
||||
self.assertEqual( self.tag.object.url, "https://api.github.com/repos/jacquev6/PyGithub/git/commits/4303c5b90e2216d927155e9609436ccb8984c495" )
|
||||
self.assertEqual( self.tag.sha, "f5f37322407b02a80de4526ad88d5f188977bc3c" )
|
||||
self.assertEqual( self.tag.tag, "v0.6" )
|
||||
self.assertEqual( self.tag.tagger.date, "2012-05-10T11:14:15-07:00" )
|
||||
self.assertEqual( self.tag.tagger.date, datetime.datetime( 2012, 5, 10, 11, 14, 15 ) )
|
||||
self.assertEqual( self.tag.tagger.timezone, datetime.timedelta( hours = -7 ) )
|
||||
self.assertEqual( self.tag.tagger.email, "vincent@vincent-jacques.net" )
|
||||
self.assertEqual( self.tag.tagger.name, "Vincent Jacques" )
|
||||
self.assertEqual( self.tag.url, "https://api.github.com/repos/jacquev6/PyGithub/git/tags/f5f37322407b02a80de4526ad88d5f188977bc3c" )
|
||||
|
||||
@@ -53,6 +53,7 @@ from Markdown import *
|
||||
from PaginatedList import *
|
||||
from Issue33 import *
|
||||
from Issue50 import *
|
||||
from Issue54 import *
|
||||
from Exceptions import *
|
||||
|
||||
Framework.main()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright 2012 Vincent Jacques
|
||||
# vincent@vincent-jacques.net
|
||||
|
||||
# This file is part of PyGithub. http://vincent-jacques.net/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
|
||||
|
||||
class Issue54( Framework.TestCase ):
|
||||
def setUp( self ):
|
||||
Framework.TestCase.setUp( self )
|
||||
self.repo = self.g.get_user().get_repo( "TestRepo" )
|
||||
|
||||
def testConversion( self ):
|
||||
commit = self.repo.get_git_commit( "73f320ae06cd565cf38faca34b6a482addfc721b" )
|
||||
self.assertEqual( commit.message, "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n" )
|
||||
self.assertEqual( commit.author.date, datetime.datetime( 2012, 7, 13, 18, 47, 10 ) )
|
||||
@@ -0,0 +1,10 @@
|
||||
GET /user {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('content-length', '801'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4986'), ('server', 'nginx/1.0.13'), ('last-modified', 'Mon, 09 Jul 2012 06:49:53 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1bd2b9dfc8ba65f7665102d6245a1593"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:43 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"html_url":"https://github.com/jacquev6","type":"User","email":"vincent@vincent-jacques.net","created_at":"2010-07-09T06:10:06Z","collaborators":0,"followers":13,"company":"Criteo","plan":{"collaborators":1,"space":614400,"private_repos":5,"name":"micro"},"hireable":false,"gravatar_id":"b68de5ae38616c296fa345d2b9df2225","disk_usage":16468,"blog":"http://vincent-jacques.net","bio":"","public_gists":3,"total_private_repos":3,"public_repos":12,"private_gists":5,"name":"Vincent Jacques","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","owned_private_repos":3,"following":26,"location":"Paris, France","id":327146,"login":"jacquev6","url":"https://api.github.com/users/jacquev6"}
|
||||
|
||||
GET /repos/jacquev6/TestRepo {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4985'), ('x-ratelimit-limit', '5000'), ('vary', 'Accept, Authorization, Cookie'), ('content-length', '1172'), ('server', 'nginx/1.0.13'), ('last-modified', 'Fri, 13 Jul 2012 18:48:49 GMT'), ('connection', 'keep-alive'), ('etag', '"385e2f22f9b54b1d56fc731de0d5c9bc"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:44 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"permissions":{"push":true,"admin":true,"pull":true},"open_issues":0,"clone_url":"https://github.com/jacquev6/TestRepo.git","ssh_url":"git@github.com:jacquev6/TestRepo.git","owner":{"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","id":327146,"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225"},"description":"Test repository created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2","master_branch":"master","mirror_url":null,"has_issues":true,"html_url":"https://github.com/jacquev6/TestRepo","pushed_at":"2012-07-13T18:47:21Z","forks":1,"has_downloads":true,"created_at":"2012-07-13T18:45:21Z","full_name":"jacquev6/TestRepo","language":null,"size":96,"fork":false,"svn_url":"https://github.com/jacquev6/TestRepo","has_wiki":true,"watchers":1,"updated_at":"2012-07-13T18:48:49Z","name":"TestRepo","git_url":"git://github.com/jacquev6/TestRepo.git","private":false,"id":5023526,"homepage":null,"url":"https://api.github.com/repos/jacquev6/TestRepo"}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
GET /repos/jacquev6/TestRepo/git/commits/73f320ae06cd565cf38faca34b6a482addfc721b {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('content-length', '676'), ('vary', 'Accept, Authorization, Cookie'), ('x-ratelimit-remaining', '4984'), ('server', 'nginx/1.0.13'), ('last-modified', 'Fri, 13 Jul 2012 18:47:10 GMT'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"ab832024b149674b5210a1a3b146575c"'), ('cache-control', 'private, max-age=60'), ('date', 'Fri, 13 Jul 2012 19:06:44 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"committer":{"email":"vincent@vincent-jacques.net","date":"2012-07-13T11:47:10-07:00","name":"Vincent Jacques"},"message":"Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n","sha":"73f320ae06cd565cf38faca34b6a482addfc721b","tree":{"sha":"52fe1ba4ac2b979c0a8fbeb9f87c1b1c9f177520","url":"https://api.github.com/repos/jacquev6/TestRepo/git/trees/52fe1ba4ac2b979c0a8fbeb9f87c1b1c9f177520"},"author":{"email":"vincent@vincent-jacques.net","date":"2012-07-13T11:47:10-07:00","name":"Vincent Jacques"},"parents":[],"url":"https://api.github.com/repos/jacquev6/TestRepo/git/commits/73f320ae06cd565cf38faca34b6a482addfc721b"}
|
||||
|
||||
Reference in New Issue
Block a user