mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +00:00
+1
-1
@@ -21,7 +21,7 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
# #189: Line endings should be linux style
|
||||
# #193: Line endings should be linux style
|
||||
|
||||
# TODO: As of Thu Aug 21 22:40:13 (BJT) Chinese Standard Time 2013
|
||||
# lots of consts in this project are explict
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -290,8 +290,8 @@ class Requester:
|
||||
requestHeaders["Authorization"] = self.__authorizationHeader
|
||||
|
||||
def __conditional(self, requestHeaders, parameters):
|
||||
# #189: Why pass etag and last_modified by param "parameters"?
|
||||
# #189: May be better to add a specific param "headers" to methods requestFoobar?
|
||||
# #193: Why pass etag and last_modified by param "parameters"?
|
||||
# #193: May be better to add a specific param "headers" to methods requestFoobar?
|
||||
etag = parameters.get(Consts.REQ_IF_NONE_MATCH)
|
||||
last_modified = parameters.get(Consts.REQ_IF_MODIFIED_SINCE)
|
||||
if etag is not None:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
# #189: Line endings should be linux style
|
||||
# #193: Line endings should be linux style
|
||||
|
||||
import Framework
|
||||
import github
|
||||
@@ -31,7 +31,7 @@ class ConditionalRequestUpdate(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.repo = self.g.get_repo("akfish/PyGithub")
|
||||
# #189: Let's separate this assert in its own test method, remove it from setUp.
|
||||
# #193: Let's separate this assert in its own test method, remove it from setUp.
|
||||
# Not updated
|
||||
self.assertFalse(self.repo.update(), msg="The repo is not changes. But update() != False")
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import github.tests.Framework
|
||||
import github.tests.AllTests
|
||||
|
||||
|
||||
# #189: This seems equivalent to "python -m github.tests ClassName.methodName --record"
|
||||
# #193: This seems equivalent to "python -m github.tests ClassName.methodName --record"
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
Reference in New Issue
Block a user