From 3bd3f0c80796445131cdd913031b481189808ebf Mon Sep 17 00:00:00 2001 From: Nic Dahlquist Date: Fri, 26 Dec 2014 18:45:48 -0800 Subject: [PATCH] Change InputGitAuthor to reflect that time is an optional parameter. --- .gitignore | 1 + github/InputGitAuthor.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 41bec3ec..b0fb8a8b 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ /MANIFEST /PyGithub.egg-info/ /.coverage +/.idea /developer.github.com/ /gh-pages/ /doc/doctrees/ diff --git a/github/InputGitAuthor.py b/github/InputGitAuthor.py index 82a7c3bb..4567f417 100644 --- a/github/InputGitAuthor.py +++ b/github/InputGitAuthor.py @@ -23,12 +23,14 @@ # # # ############################################################################## +import github.GithubObject + class InputGitAuthor(object): """ """ - def __init__(self, name, email, date): + def __init__(self, name, email, date=github.GithubObject.NotSet): """ :param name: string :param email: string @@ -37,15 +39,18 @@ class InputGitAuthor(object): assert isinstance(name, (str, unicode)), name assert isinstance(email, (str, unicode)), email - assert isinstance(date, (str, unicode)), date # @todo Datetime? + assert date is github.GithubObject.NotSet or isinstance(date, (str, unicode)), date # @todo Datetime? + self.__name = name self.__email = email self.__date = date @property def _identity(self): - return { + identity = { "name": self.__name, "email": self.__email, - "date": self.__date, } + if self.__date is not github.GithubObject.NotSet: + identity["date"] = self.__date + return identity