mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user