Fix remarks on #189 to #193

This commit is contained in:
Vincent Jacques
2013-08-23 09:32:47 +02:00
parent 0f74e4389b
commit fb7325884e
5 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -100,17 +100,17 @@ class GithubObject(object):
else:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")
def save(self, file_name): # #189: Could we use file-like objects? It would be more "pythonic" than passing filenames.
def save(self, file_name): # #193: Could we use file-like objects? It would be more "pythonic" than passing filenames.
'''
Save instance to a file
:param file_name: the full path of target file
'''
with open(file_name, 'wb') as f:
pickle.dump(self, f) # #189: This will also save self._requester, and the login/password of the user. She might not appriciate.
# #189: May be better to pickle only self._rawData and self._headers and restore the object with Github.create_from_raw_data
pickle.dump(self, f) # #193: This will also save self._requester, and the login/password of the user. She might not appriciate.
# #193: May be better to pickle only self._rawData and self._headers and restore the object with Github.create_from_raw_data
@classmethod # #189: Could be a @staticmethod? The docstring would be simpler (no need to explain the type will be same as saved).
def load(cls, file_name): # #189: Could we use file-like objects? It would be more "pythonic" than passing filenames.
@classmethod # #193: Could be a @staticmethod? The docstring would be simpler (no need to explain the type will be same as saved).
def load(cls, file_name): # #193: Could we use file-like objects? It would be more "pythonic" than passing filenames.
'''
Load saved instance from file
:param file_name: the full path to saved file
@@ -154,7 +154,7 @@ class GithubObject(object):
self._storeAndUseAttributes(data)
self.__completed = True
return True
except GithubException.NotModifiedException: # #189: Why raise and catch? Can't we just check?
except GithubException.NotModifiedException: # #193: Why raise and catch? Can't we just check?
return False