@@ -24,8 +24,7 @@ class Blob(GitHubObject):
24
24
25
25
"""
26
26
27
- def __init__ (self , blob ):
28
- super (Blob , self ).__init__ (blob )
27
+ def _update_attributes (self , blob ):
29
28
self ._api = blob .get ('url' , '' )
30
29
31
30
#: Raw content of the blob.
@@ -56,8 +55,7 @@ class GitData(GitHubCore):
56
55
57
56
"""
58
57
59
- def __init__ (self , data , session = None ):
60
- super (GitData , self ).__init__ (data , session )
58
+ def _update_attributes (self , data ):
61
59
#: SHA of the object
62
60
self .sha = data .get ('sha' )
63
61
self ._api = data .get ('url' , '' )
@@ -72,9 +70,7 @@ class Commit(BaseCommit):
72
70
73
71
"""
74
72
75
- def __init__ (self , commit , session = None ):
76
- super (Commit , self ).__init__ (commit , session )
77
-
73
+ def _update_attributes (self , commit ):
78
74
#: dict containing at least the name, email and date the commit was
79
75
#: created
80
76
self .author = commit .get ('author' , {}) or {}
@@ -121,8 +117,7 @@ class Reference(GitHubCore):
121
117
122
118
"""
123
119
124
- def __init__ (self , ref , session = None ):
125
- super (Reference , self ).__init__ (ref , session )
120
+ def _update_attributes (self , ref ):
126
121
self ._api = ref .get ('url' , '' )
127
122
#: The reference path, e.g., refs/heads/sc/featureA
128
123
self .ref = ref .get ('ref' )
@@ -132,9 +127,6 @@ def __init__(self, ref, session=None):
132
127
def _repr (self ):
133
128
return '<Reference [{0}]>' .format (self .ref )
134
129
135
- def _update_ (self , ref ):
136
- self .__init__ (ref , self .session )
137
-
138
130
@requires_auth
139
131
def delete (self ):
140
132
"""Delete this reference.
@@ -156,7 +148,7 @@ def update(self, sha, force=False):
156
148
data = {'sha' : sha , 'force' : force }
157
149
json = self ._json (self ._patch (self ._api , data = dumps (data )), 200 )
158
150
if json :
159
- self ._update_ (json )
151
+ self ._update_attributes (json )
160
152
return True
161
153
return False
162
154
@@ -165,8 +157,7 @@ class GitObject(GitData):
165
157
166
158
"""The :class:`GitObject <GitObject>` object."""
167
159
168
- def __init__ (self , obj ):
169
- super (GitObject , self ).__init__ (obj , None )
160
+ def _update_attributes (self , obj ):
170
161
#: The type of object.
171
162
self .type = obj .get ('type' )
172
163
@@ -182,8 +173,7 @@ class Tag(GitData):
182
173
183
174
"""
184
175
185
- def __init__ (self , tag ):
186
- super (Tag , self ).__init__ (tag , None )
176
+ def _update_attributes (self , tag ):
187
177
#: String of the tag
188
178
self .tag = tag .get ('tag' )
189
179
#: Commit message for the tag
@@ -205,8 +195,7 @@ class Tree(GitData):
205
195
206
196
"""
207
197
208
- def __init__ (self , tree , session = None ):
209
- super (Tree , self ).__init__ (tree , session )
198
+ def _update_attributes (self , tree ):
210
199
#: list of :class:`Hash <Hash>` objects
211
200
self .tree = [Hash (t ) for t in tree .get ('tree' , [])]
212
201
@@ -231,8 +220,7 @@ class Hash(GitHubObject):
231
220
232
221
"""
233
222
234
- def __init__ (self , info ):
235
- super (Hash , self ).__init__ (info )
223
+ def _update_attribute (self , info ):
236
224
#: Path to file
237
225
self .path = info .get ('path' )
238
226
#: File mode
0 commit comments