Skip to content
This repository
Browse code

Do all paginated calls inside PaginatedList

This was already the case for Legacy.PaginatedList.

Doing it in PaginatedList.PaginatedList reduces the amount of
repeated code and will allow a generic solution for issue #77
  • Loading branch information...
commit ef403a15947f3fd5176fa97e6a2f2b0e7dfa6913 1 parent 25a7696
Vincent Jacques authored

Showing 25 changed files with 200 additions and 553 deletions. Show diff stats Hide diff stats

  1. +28 112 github/AuthenticatedUser.py
  2. +4 16 github/Commit.py
  3. +2 8 github/Gist.py
  4. +2 3 github/Github.py
  5. +6 24 github/Issue.py
  6. +1 2  github/Legacy.py
  7. +2 8 github/Milestone.py
  8. +24 96 github/NamedUser.py
  9. +10 40 github/Organization.py
  10. +8 7 github/PaginatedList.py
  11. +8 32 github/PullRequest.py
  12. +46 184 github/Repository.py
  13. +4 16 github/Team.py
  14. +5 0 test/ReplayData/Github.testLegacySearchReposExplicitPagination.txt
  15. +5 0 test/ReplayData/Github.testLegacySearchUsersExplicitPagination.txt
  16. +0 5 test/ReplayData/PaginatedList.setUp.txt
  17. +5 0 test/ReplayData/PaginatedList.testIntIndexingAfterIteration.txt
  18. +5 0 test/ReplayData/PaginatedList.testIntIndexingInFirstPage.txt
  19. +5 0 test/ReplayData/PaginatedList.testIntIndexingInThirdPage.txt
  20. +5 0 test/ReplayData/PaginatedList.testInterruptedIteration.txt
  21. +5 0 test/ReplayData/PaginatedList.testInterruptedIterationInSlice.txt
  22. +5 0 test/ReplayData/PaginatedList.testIteration.txt
  23. +5 0 test/ReplayData/PaginatedList.testSliceIndexingInFirstPage.txt
  24. +5 0 test/ReplayData/PaginatedList.testSliceIndexingUntilEnd.txt
  25. +5 0 test/ReplayData/PaginatedList.testSliceIndexingUntilFourthPage.txt
140 github/AuthenticatedUser.py
@@ -332,17 +332,11 @@ def get_authorization( self, id ):
332 332 return Authorization.Authorization( self._requester, data, completed = True )
333 333
334 334 def get_authorizations( self ):
335   - headers, data = self._requester.requestAndCheck(
336   - "GET",
337   - "/authorizations",
338   - None,
339   - None
340   - )
341 335 return PaginatedList.PaginatedList(
342 336 Authorization.Authorization,
343 337 self._requester,
344   - headers,
345   - data
  338 + "/authorizations",
  339 + None
346 340 )
347 341
348 342 def get_emails( self ):
@@ -355,73 +349,43 @@ def get_emails( self ):
355 349 return data
356 350
357 351 def get_events( self ):
358   - headers, data = self._requester.requestAndCheck(
359   - "GET",
360   - "/events",
361   - None,
362   - None
363   - )
364 352 return PaginatedList.PaginatedList(
365 353 Event.Event,
366 354 self._requester,
367   - headers,
368   - data
  355 + "/events",
  356 + None
369 357 )
370 358
371 359 def get_followers( self ):
372   - headers, data = self._requester.requestAndCheck(
373   - "GET",
374   - "/user/followers",
375   - None,
376   - None
377   - )
378 360 return PaginatedList.PaginatedList(
379 361 NamedUser.NamedUser,
380 362 self._requester,
381   - headers,
382   - data
  363 + "/user/followers",
  364 + None
383 365 )
384 366
385 367 def get_following( self ):
386   - headers, data = self._requester.requestAndCheck(
387   - "GET",
388   - "/user/following",
389   - None,
390   - None
391   - )
392 368 return PaginatedList.PaginatedList(
393 369 NamedUser.NamedUser,
394 370 self._requester,
395   - headers,
396   - data
  371 + "/user/following",
  372 + None
397 373 )
398 374
399 375 def get_gists( self ):
400   - headers, data = self._requester.requestAndCheck(
401   - "GET",
402   - "/gists",
403   - None,
404   - None
405   - )
406 376 return PaginatedList.PaginatedList(
407 377 Gist.Gist,
408 378 self._requester,
409   - headers,
410   - data
  379 + "/gists",
  380 + None
411 381 )
412 382
413 383 def get_issues( self ):
414   - headers, data = self._requester.requestAndCheck(
415   - "GET",
416   - "/issues",
417   - None,
418   - None
419   - )
420 384 return PaginatedList.PaginatedList(
421 385 Issue.Issue,
422 386 self._requester,
423   - headers,
424   - data
  387 + "/issues",
  388 + None
425 389 )
426 390
427 391 def get_key( self, id ):
@@ -435,46 +399,28 @@ def get_key( self, id ):
435 399 return UserKey.UserKey( self._requester, data, completed = True )
436 400
437 401 def get_keys( self ):
438   - headers, data = self._requester.requestAndCheck(
439   - "GET",
440   - "/user/keys",
441   - None,
442   - None
443   - )
444 402 return PaginatedList.PaginatedList(
445 403 UserKey.UserKey,
446 404 self._requester,
447   - headers,
448   - data
  405 + "/user/keys",
  406 + None
449 407 )
450 408
451 409 def get_organization_events( self, org ):
452 410 assert isinstance( org, Organization.Organization ), org
453   - headers, data = self._requester.requestAndCheck(
454   - "GET",
455   - "/users/" + self.login + "/events/orgs/" + org.login,
456   - None,
457   - None
458   - )
459 411 return PaginatedList.PaginatedList(
460 412 Event.Event,
461 413 self._requester,
462   - headers,
463   - data
  414 + "/users/" + self.login + "/events/orgs/" + org.login,
  415 + None
464 416 )
465 417
466 418 def get_orgs( self ):
467   - headers, data = self._requester.requestAndCheck(
468   - "GET",
469   - "/user/orgs",
470   - None,
471   - None
472   - )
473 419 return PaginatedList.PaginatedList(
474 420 Organization.Organization,
475 421 self._requester,
476   - headers,
477   - data
  422 + "/user/orgs",
  423 + None
478 424 )
479 425
480 426 def get_repo( self, name ):
@@ -498,73 +444,43 @@ def get_repos( self, type = GithubObject.NotSet, sort = GithubObject.NotSet, dir
498 444 url_parameters[ "sort" ] = sort
499 445 if direction is not GithubObject.NotSet:
500 446 url_parameters[ "direction" ] = direction
501   - headers, data = self._requester.requestAndCheck(
502   - "GET",
503   - "/user/repos",
504   - url_parameters,
505   - None
506   - )
507 447 return PaginatedList.PaginatedList(
508 448 Repository.Repository,
509 449 self._requester,
510   - headers,
511   - data
  450 + "/user/repos",
  451 + url_parameters
512 452 )
513 453
514 454 def get_starred( self ):
515   - headers, data = self._requester.requestAndCheck(
516   - "GET",
517   - "/user/starred",
518   - None,
519   - None
520   - )
521 455 return PaginatedList.PaginatedList(
522 456 Repository.Repository,
523 457 self._requester,
524   - headers,
525   - data
  458 + "/user/starred",
  459 + None
526 460 )
527 461
528 462 def get_starred_gists( self ):
529   - headers, data = self._requester.requestAndCheck(
530   - "GET",
531   - "/gists/starred",
532   - None,
533   - None
534   - )
535 463 return PaginatedList.PaginatedList(
536 464 Gist.Gist,
537 465 self._requester,
538   - headers,
539   - data
  466 + "/gists/starred",
  467 + None
540 468 )
541 469
542 470 def get_subscriptions( self ):
543   - headers, data = self._requester.requestAndCheck(
544   - "GET",
545   - "/user/subscriptions",
546   - None,
547   - None
548   - )
549 471 return PaginatedList.PaginatedList(
550 472 Repository.Repository,
551 473 self._requester,
552   - headers,
553   - data
  474 + "/user/subscriptions",
  475 + None
554 476 )
555 477
556 478 def get_watched( self ):
557   - headers, data = self._requester.requestAndCheck(
558   - "GET",
559   - "/user/watched",
560   - None,
561   - None
562   - )
563 479 return PaginatedList.PaginatedList(
564 480 Repository.Repository,
565 481 self._requester,
566   - headers,
567   - data
  482 + "/user/watched",
  483 + None
568 484 )
569 485
570 486 def has_in_following( self, following ):
20 github/Commit.py
@@ -105,31 +105,19 @@ def create_status( self, state, target_url = GithubObject.NotSet, description =
105 105 return CommitStatus.CommitStatus( self._requester, data, completed = True )
106 106
107 107 def get_comments( self ):
108   - headers, data = self._requester.requestAndCheck(
109   - "GET",
110   - self.url + "/comments",
111   - None,
112   - None
113   - )
114 108 return PaginatedList.PaginatedList(
115 109 CommitComment.CommitComment,
116 110 self._requester,
117   - headers,
118   - data
  111 + self.url + "/comments",
  112 + None
119 113 )
120 114
121 115 def get_statuses( self ):
122   - headers, data = self._requester.requestAndCheck(
123   - "GET",
124   - self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
125   - None,
126   - None
127   - )
128 116 return PaginatedList.PaginatedList(
129 117 CommitStatus.CommitStatus,
130 118 self._requester,
131   - headers,
132   - data
  119 + self._parentUrl( self._parentUrl( self.url ) ) + "/statuses/" + self.sha,
  120 + None
133 121 )
134 122
135 123 @property
10 github/Gist.py
@@ -154,17 +154,11 @@ def get_comment( self, id ):
154 154 return GistComment.GistComment( self._requester, data, completed = True )
155 155
156 156 def get_comments( self ):
157   - headers, data = self._requester.requestAndCheck(
158   - "GET",
159   - self.url + "/comments",
160   - None,
161   - None
162   - )
163 157 return PaginatedList.PaginatedList(
164 158 GistComment.GistComment,
165 159 self._requester,
166   - headers,
167   - data
  160 + self.url + "/comments",
  161 + None
168 162 )
169 163
170 164 def is_starred( self ):
5 github/Github.py
@@ -69,12 +69,11 @@ def get_gist( self, id ):
69 69 return Gist.Gist( self.__requester, data, completed = True )
70 70
71 71 def get_gists( self ):
72   - headers, data = self.__requester.requestAndCheck( "GET", "/gists/public", None, None )
73 72 return PaginatedList.PaginatedList(
74 73 Gist.Gist,
75 74 self.__requester,
76   - headers,
77   - data
  75 + "/gists/public",
  76 + None
78 77 )
79 78
80 79 def legacy_search_repos( self, keyword, language = GithubObject.NotSet ):
30 github/Issue.py
@@ -183,45 +183,27 @@ def get_comment( self, id ):
183 183 return IssueComment.IssueComment( self._requester, data, completed = True )
184 184
185 185 def get_comments( self ):
186   - headers, data = self._requester.requestAndCheck(
187   - "GET",
188   - self.url + "/comments",
189   - None,
190   - None
191   - )
192 186 return PaginatedList.PaginatedList(
193 187 IssueComment.IssueComment,
194 188 self._requester,
195   - headers,
196   - data
  189 + self.url + "/comments",
  190 + None
197 191 )
198 192
199 193 def get_events( self ):
200   - headers, data = self._requester.requestAndCheck(
201   - "GET",
202   - self.url + "/events",
203   - None,
204   - None
205   - )
206 194 return PaginatedList.PaginatedList(
207 195 IssueEvent.IssueEvent,
208 196 self._requester,
209   - headers,
210   - data
  197 + self.url + "/events",
  198 + None
211 199 )
212 200
213 201 def get_labels( self ):
214   - headers, data = self._requester.requestAndCheck(
215   - "GET",
216   - self.url + "/labels",
217   - None,
218   - None
219   - )
220 202 return PaginatedList.PaginatedList(
221 203 Label.Label,
222 204 self._requester,
223   - headers,
224   - data
  205 + self.url + "/labels",
  206 + None
225 207 )
226 208
227 209 def remove_from_labels( self, label ):
3  github/Legacy.py
@@ -15,7 +15,7 @@
15 15
16 16 class PaginatedList( PaginatedListBase ):
17 17 def __init__( self, url, args, requester, key, convert, contentClass ):
18   - PaginatedListBase.__init__( self, list() )
  18 + PaginatedListBase.__init__( self )
19 19 self.__url = url
20 20 self.__args = args
21 21 self.__requester = requester
@@ -24,7 +24,6 @@ def __init__( self, url, args, requester, key, convert, contentClass ):
24 24 self.__contentClass = contentClass
25 25 self.__nextPage = 1
26 26 self.__continue = True
27   - self.__elements = list()
28 27
29 28 def _couldGrow( self ):
30 29 return self.__continue
10 github/Milestone.py
@@ -106,17 +106,11 @@ def edit( self, title, state = GithubObject.NotSet, description = GithubObject.N
106 106 self._useAttributes( data )
107 107
108 108 def get_labels( self ):
109   - headers, data = self._requester.requestAndCheck(
110   - "GET",
111   - self.url + "/labels",
112   - None,
113   - None
114   - )
115 109 return PaginatedList.PaginatedList(
116 110 Label.Label,
117 111 self._requester,
118   - headers,
119   - data
  112 + self.url + "/labels",
  113 + None
120 114 )
121 115
122 116 @property
120 github/NamedUser.py
@@ -172,115 +172,67 @@ def create_gist( self, public, files, description = GithubObject.NotSet ):
172 172 return Gist.Gist( self._requester, data, completed = True )
173 173
174 174 def get_events( self ):
175   - headers, data = self._requester.requestAndCheck(
176   - "GET",
177   - self.url + "/events",
178   - None,
179   - None
180   - )
181 175 return PaginatedList.PaginatedList(
182 176 Event.Event,
183 177 self._requester,
184   - headers,
185   - data
  178 + self.url + "/events",
  179 + None
186 180 )
187 181
188 182 def get_followers( self ):
189   - headers, data = self._requester.requestAndCheck(
190   - "GET",
191   - self.url + "/followers",
192   - None,
193   - None
194   - )
195 183 return PaginatedList.PaginatedList(
196 184 NamedUser,
197 185 self._requester,
198   - headers,
199   - data
  186 + self.url + "/followers",
  187 + None
200 188 )
201 189
202 190 def get_following( self ):
203   - headers, data = self._requester.requestAndCheck(
204   - "GET",
205   - self.url + "/following",
206   - None,
207   - None
208   - )
209 191 return PaginatedList.PaginatedList(
210 192 NamedUser,
211 193 self._requester,
212   - headers,
213   - data
  194 + self.url + "/following",
  195 + None
214 196 )
215 197
216 198 def get_gists( self ):
217   - headers, data = self._requester.requestAndCheck(
218   - "GET",
219   - self.url + "/gists",
220   - None,
221   - None
222   - )
223 199 return PaginatedList.PaginatedList(
224 200 Gist.Gist,
225 201 self._requester,
226   - headers,
227   - data
  202 + self.url + "/gists",
  203 + None
228 204 )
229 205
230 206 def get_orgs( self ):
231   - headers, data = self._requester.requestAndCheck(
232   - "GET",
233   - self.url + "/orgs",
234   - None,
235   - None
236   - )
237 207 return PaginatedList.PaginatedList(
238 208 Organization.Organization,
239 209 self._requester,
240   - headers,
241   - data
  210 + self.url + "/orgs",
  211 + None
242 212 )
243 213
244 214 def get_public_events( self ):
245   - headers, data = self._requester.requestAndCheck(
246   - "GET",
247   - self.url + "/events/public",
248   - None,
249   - None
250   - )
251 215 return PaginatedList.PaginatedList(
252 216 Event.Event,
253 217 self._requester,
254   - headers,
255   - data
  218 + self.url + "/events/public",
  219 + None
256 220 )
257 221
258 222 def get_public_received_events( self ):
259   - headers, data = self._requester.requestAndCheck(
260   - "GET",
261   - self.url + "/received_events/public",
262   - None,
263   - None
264   - )
265 223 return PaginatedList.PaginatedList(
266 224 Event.Event,
267 225 self._requester,
268   - headers,
269   - data
  226 + self.url + "/received_events/public",
  227 + None
270 228 )
271 229
272 230 def get_received_events( self ):
273   - headers, data = self._requester.requestAndCheck(
274   - "GET",
275   - self.url + "/received_events",
276   - None,
277   - None
278   - )
279 231 return PaginatedList.PaginatedList(
280 232 Event.Event,
281 233 self._requester,
282   - headers,
283   - data
  234 + self.url + "/received_events",
  235 + None
284 236 )
285 237
286 238 def get_repo( self, name ):
@@ -298,59 +250,35 @@ def get_repos( self, type = GithubObject.NotSet ):
298 250 url_parameters = dict()
299 251 if type is not GithubObject.NotSet:
300 252 url_parameters[ "type" ] = type
301   - headers, data = self._requester.requestAndCheck(
302   - "GET",
303   - self.url + "/repos",
304   - url_parameters,
305   - None
306   - )
307 253 return PaginatedList.PaginatedList(
308 254 Repository.Repository,
309 255 self._requester,
310   - headers,
311   - data
  256 + self.url + "/repos",
  257 + url_parameters
312 258 )
313 259
314 260 def get_starred( self ):
315   - headers, data = self._requester.requestAndCheck(
316   - "GET",
317   - self.url + "/starred",
318   - None,
319   - None
320   - )
321 261 return PaginatedList.PaginatedList(
322 262 Repository.Repository,
323 263 self._requester,
324   - headers,
325   - data
  264 + self.url + "/starred",
  265 + None
326 266 )
327 267
328 268 def get_subscriptions( self ):
329   - headers, data = self._requester.requestAndCheck(
330   - "GET",
331   - self.url + "/subscriptions",
332   - None,
333   - None
334   - )
335 269 return PaginatedList.PaginatedList(
336 270 Repository.Repository,
337 271 self._requester,
338   - headers,
339   - data
  272 + self.url + "/subscriptions",
  273 + None
340 274 )
341 275
342 276 def get_watched( self ):
343   - headers, data = self._requester.requestAndCheck(
344   - "GET",
345   - self.url + "/watched",
346   - None,
347   - None
348   - )
349 277 return PaginatedList.PaginatedList(
350 278 Repository.Repository,
351 279 self._requester,
352   - headers,
353   - data
  280 + self.url + "/watched",
  281 + None
354 282 )
355 283
356 284 @property
50 github/Organization.py
@@ -245,45 +245,27 @@ def edit( self, billing_email = GithubObject.NotSet, blog = GithubObject.NotSet,
245 245 self._useAttributes( data )
246 246
247 247 def get_events( self ):
248   - headers, data = self._requester.requestAndCheck(
249   - "GET",
250   - self.url + "/events",
251   - None,
252   - None
253   - )
254 248 return PaginatedList.PaginatedList(
255 249 Event.Event,
256 250 self._requester,
257   - headers,
258   - data
  251 + self.url + "/events",
  252 + None
259 253 )
260 254
261 255 def get_members( self ):
262   - headers, data = self._requester.requestAndCheck(
263   - "GET",
264   - self.url + "/members",
265   - None,
266   - None
267   - )
268 256 return PaginatedList.PaginatedList(
269 257 NamedUser.NamedUser,
270 258 self._requester,
271   - headers,
272   - data
  259 + self.url + "/members",
  260 + None
273 261 )
274 262
275 263 def get_public_members( self ):
276   - headers, data = self._requester.requestAndCheck(
277   - "GET",
278   - self.url + "/public_members",
279   - None,
280   - None
281   - )
282 264 return PaginatedList.PaginatedList(
283 265 NamedUser.NamedUser,
284 266 self._requester,
285   - headers,
286   - data
  267 + self.url + "/public_members",
  268 + None
287 269 )
288 270
289 271 def get_repo( self, name ):
@@ -301,17 +283,11 @@ def get_repos( self, type = GithubObject.NotSet ):
301 283 url_parameters = dict()
302 284 if type is not GithubObject.NotSet:
303 285 url_parameters[ "type" ] = type
304   - headers, data = self._requester.requestAndCheck(
305   - "GET",
306   - self.url + "/repos",
307   - url_parameters,
308   - None
309   - )
310 286 return PaginatedList.PaginatedList(
311 287 Repository.Repository,
312 288 self._requester,
313   - headers,
314   - data
  289 + self.url + "/repos",
  290 + url_parameters
315 291 )
316 292
317 293 def get_team( self, id ):
@@ -325,17 +301,11 @@ def get_team( self, id ):
325 301 return Team.Team( self._requester, data, completed = True )
326 302
327 303 def get_teams( self ):
328   - headers, data = self._requester.requestAndCheck(
329   - "GET",
330   - self.url + "/teams",
331   - None,
332   - None
333   - )
334 304 return PaginatedList.PaginatedList(
335 305 Team.Team,
336 306 self._requester,
337   - headers,
338   - data
  307 + self.url + "/teams",
  308 + None
339 309 )
340 310
341 311 def has_in_members( self, member ):
15 github/PaginatedList.py
@@ -14,8 +14,8 @@
14 14 import GithubObject
15 15
16 16 class PaginatedListBase:
17   - def __init__( self, firstElements ):
18   - self.__elements = firstElements
  17 + def __init__( self ):
  18 + self.__elements = list()
19 19
20 20 def __getitem__( self, index ):
21 21 assert isinstance( index, ( int, slice ) )
@@ -65,24 +65,25 @@ def __finished( self, index ):
65 65 return self.__stop is not None and index >= self.__stop
66 66
67 67 class PaginatedList( PaginatedListBase ):
68   - def __init__( self, contentClass, requester, headers, data ):
  68 + def __init__( self, contentClass, requester, nextUrl, nextParams ):
  69 + PaginatedListBase.__init__( self )
69 70 self.__requester = requester
70 71 self.__contentClass = contentClass
71   - PaginatedListBase.__init__( self, self.__extractNewElements( headers, data ) )
  72 + self.__nextUrl = nextUrl
  73 + self.__nextParams = nextParams
72 74
73 75 def _couldGrow( self ):
74 76 return self.__nextUrl is not None
75 77
76 78 def _fetchNextPage( self ):
77   - headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, None, None )
78   - return self.__extractNewElements( headers, data )
  79 + headers, data = self.__requester.requestAndCheck( "GET", self.__nextUrl, self.__nextParams, None )
79 80
80   - def __extractNewElements( self, headers, data ):
81 81 links = self.__parseLinkHeader( headers )
82 82 if len( data ) > 0 and "next" in links:
83 83 self.__nextUrl = links[ "next" ]
84 84 else:
85 85 self.__nextUrl = None
  86 + self.__nextParams = None
86 87
87 88 return [
88 89 self.__contentClass( self.__requester, element, completed = False )
40 github/PullRequest.py
@@ -224,45 +224,27 @@ def get_comments( self ):
224 224 return self.get_review_comments()
225 225
226 226 def get_review_comments( self ):
227   - headers, data = self._requester.requestAndCheck(
228   - "GET",
229   - self.url + "/comments",
230   - None,
231   - None
232   - )
233 227 return PaginatedList.PaginatedList(
234 228 PullRequestComment.PullRequestComment,
235 229 self._requester,
236   - headers,
237   - data
  230 + self.url + "/comments",
  231 + None
238 232 )
239 233
240 234 def get_commits( self ):
241   - headers, data = self._requester.requestAndCheck(
242   - "GET",
243   - self.url + "/commits",
244   - None,
245   - None
246   - )
247 235 return PaginatedList.PaginatedList(
248 236 Commit.Commit,
249 237 self._requester,
250   - headers,
251   - data
  238 + self.url + "/commits",
  239 + None
252 240 )
253 241
254 242 def get_files( self ):
255   - headers, data = self._requester.requestAndCheck(
256   - "GET",
257   - self.url + "/files",
258   - None,
259   - None
260   - )
261 243 return PaginatedList.PaginatedList(
262 244 File.File,
263 245 self._requester,
264   - headers,
265   - data
  246 + self.url + "/files",
  247 + None
266 248 )
267 249
268 250 def get_issue_comment( self, id ):
@@ -276,17 +258,11 @@ def get_issue_comment( self, id ):
276 258 return IssueComment.IssueComment( self._requester, data, completed = True )
277 259
278 260 def get_issue_comments( self ):
279   - headers, data = self._requester.requestAndCheck(
280   - "GET",
281   - self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
282   - None,
283   - None
284   - )
285 261 return PaginatedList.PaginatedList(
286 262 IssueComment.IssueComment,
287 263 self._requester,
288   - headers,
289   - data
  264 + self._parentUrl( self._parentUrl( self.url ) ) + "/issues/" + str( self.number ) + "/comments",
  265 + None
290 266 )
291 267
292 268 def is_merged( self ):
230 github/Repository.py
@@ -510,17 +510,11 @@ def get_archive_link( self, archive_format, ref = GithubObject.NotSet ):
510 510 return headers[ "location" ]
511 511
512 512 def get_assignees( self ):
513   - headers, data = self._requester.requestAndCheck(
514   - "GET",
515   - self.url + "/assignees",
516   - None,
517   - None
518   - )
519 513 return PaginatedList.PaginatedList(
520 514 NamedUser.NamedUser,
521 515 self._requester,
522   - headers,
523   - data
  516 + self.url + "/assignees",
  517 + None
524 518 )
525 519
526 520 def get_branch( self, branch ):
@@ -534,31 +528,19 @@ def get_branch( self, branch ):
534 528 return Branch.Branch( self._requester, data, completed = True )
535 529
536 530 def get_branches( self ):
537   - headers, data = self._requester.requestAndCheck(
538   - "GET",
539   - self.url + "/branches",
540   - None,
541   - None
542   - )
543 531 return PaginatedList.PaginatedList(
544 532 Branch.Branch,
545 533 self._requester,
546   - headers,
547   - data
  534 + self.url + "/branches",
  535 + None
548 536 )
549 537
550 538 def get_collaborators( self ):
551   - headers, data = self._requester.requestAndCheck(
552   - "GET",
553   - self.url + "/collaborators",
554   - None,
555   - None
556   - )
557 539 return PaginatedList.PaginatedList(
558 540 NamedUser.NamedUser,
559 541 self._requester,
560   - headers,
561   - data
  542 + self.url + "/collaborators",
  543 + None
562 544 )
563 545
564 546 def get_comment( self, id ):
@@ -572,17 +554,11 @@ def get_comment( self, id ):
572 554 return CommitComment.CommitComment( self._requester, data, completed = True )
573 555
574 556 def get_comments( self ):
575   - headers, data = self._requester.requestAndCheck(
576   - "GET",
577   - self.url + "/comments",
578   - None,
579   - None
580   - )
581 557 return PaginatedList.PaginatedList(
582 558 CommitComment.CommitComment,
583 559 self._requester,
584   - headers,
585   - data
  560 + self.url + "/comments",
  561 + None
586 562 )
587 563
588 564 def get_commit( self, sha ):
@@ -603,17 +579,11 @@ def get_commits( self, sha = GithubObject.NotSet, path = GithubObject.NotSet ):
603 579 url_parameters[ "sha" ] = sha
604 580 if path is not GithubObject.NotSet:
605 581 url_parameters[ "path" ] = path
606   - headers, data = self._requester.requestAndCheck(
607   - "GET",
608   - self.url + "/commits",
609   - url_parameters,
610   - None
611   - )
612 582 return PaginatedList.PaginatedList(
613 583 Commit.Commit,
614 584 self._requester,
615   - headers,
616   - data
  585 + self.url + "/commits",
  586 + url_parameters
617 587 )
618 588
619 589 def get_contents( self, path ):
@@ -627,17 +597,11 @@ def get_contents( self, path ):
627 597 return ContentFile.ContentFile( self._requester, data, completed = True )
628 598
629 599 def get_contributors( self ):
630   - headers, data = self._requester.requestAndCheck(
631   - "GET",
632   - self.url + "/contributors",
633   - None,
634   - None
635   - )
636 600 return PaginatedList.PaginatedList(
637 601 NamedUser.NamedUser,
638 602 self._requester,
639   - headers,
640   - data
  603 + self.url + "/contributors",
  604 + None
641 605 )
642 606
643 607 def get_download( self, id ):
@@ -651,45 +615,27 @@ def get_download( self, id ):
651 615 return Download.Download( self._requester, data, completed = True )
652 616
653 617 def get_downloads( self ):
654   - headers, data = self._requester.requestAndCheck(
655   - "GET",
656   - self.url + "/downloads",
657   - None,
658   - None
659   - )
660 618 return PaginatedList.PaginatedList(
661 619 Download.Download,
662 620 self._requester,
663   - headers,
664   - data
  621 + self.url + "/downloads",
  622 + None
665 623 )
666 624
667 625 def get_events( self ):
668   - headers, data = self._requester.requestAndCheck(
669   - "GET",
670   - self.url + "/events",
671   - None,
672   - None
673   - )
674 626 return PaginatedList.PaginatedList(
675 627 Event.Event,
676 628 self._requester,
677   - headers,
678   - data
  629 + self.url + "/events",
  630 + None
679 631 )
680 632
681 633 def get_forks( self ):
682   - headers, data = self._requester.requestAndCheck(
683   - "GET",
684   - self.url + "/forks",
685   - None,
686   - None
687   - )
688 634 return PaginatedList.PaginatedList(
689 635 Repository,
690 636 self._requester,
691   - headers,
692   - data
  637 + self.url + "/forks",
  638 + None
693 639 )
694 640
695 641 def get_git_blob( self, sha ):
@@ -723,17 +669,11 @@ def get_git_ref( self, ref ):
723 669 return GitRef.GitRef( self._requester, data, completed = True )
724 670
725 671 def get_git_refs( self ):
726   - headers, data = self._requester.requestAndCheck(
727   - "GET",
728   - self.url + "/git/refs",
729   - None,
730   - None
731   - )
732 672 return PaginatedList.PaginatedList(
733 673 GitRef.GitRef,
734 674 self._requester,
735   - headers,
736   - data
  675 + self.url + "/git/refs",
  676 + None
737 677 )
738 678
739 679 def get_git_tag( self, sha ):
@@ -771,17 +711,11 @@ def get_hook( self, id ):
771 711 return Hook.Hook( self._requester, data, completed = True )
772 712
773 713 def get_hooks( self ):
774   - headers, data = self._requester.requestAndCheck(
775   - "GET",
776   - self.url + "/hooks",
777   - None,
778   - None
779   - )
780 714 return PaginatedList.PaginatedList(
781 715 Hook.Hook,
782 716 self._requester,
783   - headers,
784   - data
  717 + self.url + "/hooks",
  718 + None
785 719 )
786 720
787 721 def get_issue( self, number ):
@@ -826,17 +760,11 @@ def get_issues( self, milestone = GithubObject.NotSet, state = GithubObject.NotS
826 760 url_parameters[ "direction" ] = direction
827 761 if since is not GithubObject.NotSet:
828 762 url_parameters[ "since" ] = since.strftime( "%Y-%m-%dT%H:%M:%SZ" )
829   - headers, data = self._requester.requestAndCheck(
830   - "GET",
831   - self.url + "/issues",
832   - url_parameters,
833   - None
834   - )
835 763 return PaginatedList.PaginatedList(
836 764 Issue.Issue,
837 765 self._requester,
838   - headers,
839   - data
  766 + self.url + "/issues",
  767 + url_parameters
840 768 )
841 769
842 770 def get_issues_event( self, id ):
@@ -850,17 +778,11 @@ def get_issues_event( self, id ):
850 778 return IssueEvent.IssueEvent( self._requester, data, completed = True )
851 779
852 780 def get_issues_events( self ):
853   - headers, data = self._requester.requestAndCheck(
854   - "GET",
855   - self.url + "/issues/events",
856   - None,
857   - None
858   - )
859 781 return PaginatedList.PaginatedList(
860 782 IssueEvent.IssueEvent,
861 783 self._requester,
862   - headers,
863   - data
  784 + self.url + "/issues/events",
  785 + None
864 786 )
865 787
866 788 def get_key( self, id ):
@@ -874,17 +796,11 @@ def get_key( self, id ):
874 796 return RepositoryKey.RepositoryKey( self._requester, data, completed = True, repoUrl = self._url )
875 797
876 798 def get_keys( self ):
877   - headers, data = self._requester.requestAndCheck(
878   - "GET",
879   - self.url + "/keys",
880   - None,
881   - None
882   - )
883 799 return PaginatedList.PaginatedList(
884 800 lambda requester, data, completed: RepositoryKey.RepositoryKey( requester, data, completed, repoUrl = self._url ),
885 801 self._requester,
886   - headers,
887   - data
  802 + self.url + "/keys",
  803 + None
888 804 )
889 805
890 806 def get_label( self, name ):
@@ -898,17 +814,11 @@ def get_label( self, name ):
898 814 return Label.Label( self._requester, data, completed = True )
899 815
900 816 def get_labels( self ):
901   - headers, data = self._requester.requestAndCheck(
902   - "GET",
903   - self.url + "/labels",
904   - None,
905   - None
906   - )
907 817 return PaginatedList.PaginatedList(
908 818 Label.Label,
909 819 self._requester,
910   - headers,
911   - data
  820 + self.url + "/labels",
  821 + None
912 822 )
913 823
914 824 def get_languages( self ):
@@ -941,31 +851,19 @@ def get_milestones( self, state = GithubObject.NotSet, sort = GithubObject.NotSe
941 851 url_parameters[ "sort" ] = sort
942 852 if direction is not GithubObject.NotSet:
943 853 url_parameters[ "direction" ] = direction
944   - headers, data = self._requester.requestAndCheck(
945   - "GET",
946   - self.url + "/milestones",
947   - url_parameters,
948   - None
949   - )
950 854 return PaginatedList.PaginatedList(
951 855 Milestone.Milestone,
952 856 self._requester,
953   - headers,
954   - data
  857 + self.url + "/milestones",
  858 + url_parameters
955 859 )
956 860
957 861 def get_network_events( self ):
958   - headers, data = self._requester.requestAndCheck(
959   - "GET",
960   - "/networks/" + self.owner.login + "/" + self.name + "/events",
961   - None,
962   - None
963   - )
964 862 return PaginatedList.PaginatedList(
965 863 Event.Event,
966 864 self._requester,
967   - headers,
968   - data
  865 + "/networks/" + self.owner.login + "/" + self.name + "/events",
  866 + None
969 867 )
970 868
971 869 def get_pull( self, number ):
@@ -983,17 +881,11 @@ def get_pulls( self, state = GithubObject.NotSet ):
983 881 url_parameters = dict()
984 882 if state is not GithubObject.NotSet:
985 883 url_parameters[ "state" ] = state
986   - headers, data = self._requester.requestAndCheck(
987   - "GET",
988   - self.url + "/pulls",
989   - url_parameters,
990   - None
991   - )
992 884 return PaginatedList.PaginatedList(
993 885 PullRequest.PullRequest,
994 886 self._requester,
995   - headers,
996   - data
  887 + self.url + "/pulls",
  888 + url_parameters
997 889 )
998 890
999 891 def get_readme( self ):
@@ -1006,73 +898,43 @@ def get_readme( self ):
1006 898 return ContentFile.ContentFile( self._requester, data, completed = True )
1007 899
1008 900 def get_stargazers( self ):
1009