Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit72a05eb

Browse files
committed
Remove list functions from GitHub.
Since I'm rewriting the tests from scratch, I really don't feel like rewritingthe tests for those functions as well. Might as well remove them now, before0.1. Also, I removed the list_watching function since that was marked asdeprecated anyway.
1 parent40e9471 commit72a05eb

File tree

4 files changed

+94
-255
lines changed

4 files changed

+94
-255
lines changed

‎HISTORY.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ History/Changelog
1010
-----------------
1111

1212
- unit tests implemented using mock instead of hitting the GitHub API (#37)
13-
- Notifications API coverage
13+
- removed ``list_*`` functions from GitHub object
14+
- Notifications API coverage (?)
1415

1516
0.1b0: 2012-10-06
1617
-----------------

‎github3/github.py

Lines changed: 11 additions & 242 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ def __init__(self, login='', password=''):
3030
def__repr__(self):
3131
return'<GitHub at 0x{0:x}>'.format(id(self))
3232

33-
def_list_follow(self,which):
34-
url=self._build_url('user',which)
35-
resp=self._get(url)
36-
json=self._json(resp,200)
37-
return [User(f,self)forfinjson]
38-
3933
def_iter_follow(self,which,number):
4034
url=self._build_url('user',which)
4135
returnself._iter(number,url,User)
@@ -233,20 +227,6 @@ def follow(self, login):
233227
resp=self._boolean(self._put(url),204,404)
234228
returnresp
235229

236-
@requires_auth
237-
defkey(self,id_num):
238-
"""Gets the authenticated user's key specified by id_num.
239-
240-
:param id_num: (required), unique id of the key
241-
:type id_num: int
242-
:returns: :class:`Key <github3.users.Key>`
243-
"""
244-
json=None
245-
ifint(id_num)>0:
246-
url=self._build_url('user','keys',str(id_num))
247-
json=self._json(self._get(url),200)
248-
returnKey(json,self)ifjsonelseNone
249-
250230
defgist(self,id_num):
251231
"""Gets the gist using the specified id number.
252232
@@ -304,10 +284,6 @@ def is_subscribed(self, login, repo):
304284
json=self._boolean(self._get(url),204,404)
305285
returnjson
306286

307-
defis_watching(self,login,repo):
308-
"""DEPRECATED: Use is_subscribed/is_starred instead."""
309-
raiseDeprecationWarning('Use is_subscribed/is_starred instead.')
310-
311287
defissue(self,owner,repository,number):
312288
"""Fetch issue #:number: from https://github.com/:owner:/:repository:
313289
@@ -324,16 +300,19 @@ def issue(self, owner, repository, number):
324300
returnrepo.issue(number)
325301
returnNone
326302

327-
@requires_basic_auth
328-
deflist_authorizations(self):
329-
"""List authorizations for the authenticated user. This will return a
330-
404 if you are using a token for authentication.
303+
@requires_auth
304+
defkey(self,id_num):
305+
"""Gets the authenticated user's key specified by id_num.
331306
332-
:returns: list of :class:`Authorization <Authorization>`\ s
307+
:param id_num: (required), unique id of the key
308+
:type id_num: int
309+
:returns: :class:`Key <github3.users.Key>`
333310
"""
334-
url=self._build_url('authorizations')
335-
json=self._json(self._get(url),200)
336-
return [Authorization(a,self)forainjson]
311+
json=None
312+
ifint(id_num)>0:
313+
url=self._build_url('user','keys',str(id_num))
314+
json=self._json(self._get(url),200)
315+
returnKey(json,self)ifjsonelseNone
337316

338317
@requires_basic_auth
339318
defiter_authorizations(self,number=-1):
@@ -347,16 +326,6 @@ def iter_authorizations(self, number=-1):
347326
url=self._build_url('authorizations')
348327
returnself._iter(int(number),url,Authorization)
349328

350-
@requires_auth
351-
deflist_emails(self):
352-
"""List email addresses for the authenticated user.
353-
354-
:returns: list of dicts
355-
"""
356-
url=self._build_url('user','emails')
357-
req=self._get(url)
358-
returnself._json(req,200)or []
359-
360329
@requires_auth
361330
defiter_emails(self,number=-1):
362331
"""Iterate over email addresses for the authenticated user.
@@ -368,15 +337,6 @@ def iter_emails(self, number=-1):
368337
url=self._build_url('user','emails')
369338
returnself._iter(int(number),url,str)
370339

371-
deflist_events(self):
372-
"""List public events.
373-
374-
:returns: list of :class:`Event <github3.events.Event>`\ s
375-
"""
376-
url=self._build_url('events')
377-
json=self._json(self._get(url),200)
378-
return [Event(ev,self)forevinjson]
379-
380340
defiter_events(self,number=-1):
381341
"""Iterate over public events.
382342
@@ -387,19 +347,6 @@ def iter_events(self, number=-1):
387347
url=self._build_url('events')
388348
returnself._iter(int(number),url,Event)
389349

390-
deflist_followers(self,login=None):
391-
"""If login is provided, return a list of followers of that
392-
login name; otherwise return a list of followers of the
393-
authenticated user.
394-
395-
:param login: (optional), login of the user to check
396-
:type login: str
397-
:returns: list of :class:`User <github3.users.User>`\ s
398-
"""
399-
iflogin:
400-
returnself.user(login).list_followers()
401-
returnself._list_follow('followers')
402-
403350
defiter_followers(self,login=None,number=-1):
404351
"""If login is provided, iterate over a list of followers of that
405352
login name; otherwise return a list of followers of the
@@ -415,19 +362,6 @@ def iter_followers(self, login=None, number=-1):
415362
returnself.user(login).iter_followers()
416363
returnself._iter_follow('followers',int(number))
417364

418-
deflist_following(self,login=None):
419-
"""If login is provided, return a list of users being followed
420-
by login; otherwise return a list of people followed by the
421-
authenticated user.
422-
423-
:param login: (optional), login of the user to check
424-
:type login: str
425-
:returns: list of :class:`User <github3.users.User>`\ s
426-
"""
427-
iflogin:
428-
returnself.user(login).iter_following()
429-
returnself._list_follow('following')
430-
431365
defiter_following(self,login=None,number=-1):
432366
"""If login is provided, iterate over a list of users being followed
433367
by login; otherwise return a list of people followed by the
@@ -443,21 +377,6 @@ def iter_following(self, login=None, number=-1):
443377
returnself.user(login).iter_following()
444378
returnself._iter_follow('followers',int(number))
445379

446-
deflist_gists(self,username=None):
447-
"""If no username is specified, GET /gists, otherwise GET
448-
/users/:username/gists
449-
450-
:param login: (optional), login of the user to check
451-
:type login: str
452-
:returns: list of :class:`Gist <github3.gists.Gist>`\ s
453-
"""
454-
ifusername:
455-
url=self._build_url('users',username,'gists')
456-
else:
457-
url=self._build_url('gists')
458-
json=self._json(self._get(url),200)
459-
return [Gist(gist,self)forgistinjson]
460-
461380
defiter_gists(self,username=None,number=-1):
462381
"""If no username is specified, GET /gists, otherwise GET
463382
/users/:username/gists
@@ -555,61 +474,6 @@ def iter_user_issues(self, filter='', state='', labels='', sort='',
555474
params=issue_params(filter,state,labels,sort,direction,since)
556475
returnself._iter(int(number),url,Issue,params=params)
557476

558-
@requires_auth
559-
deflist_issues(self,filter='',state='',labels='',sort='',
560-
direction='',since=''):
561-
"""List the authenticated user's issues.
562-
563-
:param str filter: accepted values:
564-
('assigned', 'created', 'mentioned', 'subscribed')
565-
api-default: 'assigned'
566-
:param str state: accepted values: ('open', 'closed')
567-
api-default: 'open'
568-
:param str labels: comma-separated list of label names, e.g.,
569-
'bug,ui,@high'
570-
:param str sort: accepted values: ('created', 'updated', 'comments')
571-
api-default: created
572-
:param str direction: accepted values: ('asc', 'desc')
573-
api-default: desc
574-
:param str since: ISO 8601 formatted timestamp, e.g.,
575-
2012-05-20T23:10:27Z
576-
"""
577-
url=self._build_url('issues')
578-
params=issue_params(filter,state,labels,sort,direction,
579-
since)
580-
json=self._json(self._get(url,params=params),200)
581-
return [Issue(issue,self)forissueinjson]
582-
583-
deflist_repo_issues(self,owner,repository,milestone=None,
584-
state='',assignee='',mentioned='',labels='',sort='',direction='',
585-
since=''):
586-
"""List issues on owner/repository. Only owner and repository are
587-
required.
588-
589-
:param str owner: login of the owner of the repository
590-
:param str repository: name of the repository
591-
:param int milestone: None, '*', or ID of milestone
592-
:param str state: accepted values: ('open', 'closed')
593-
api-default: 'open'
594-
:param str assignee: '*' or login of the user
595-
:param str mentioned: login of the user
596-
:param str labels: comma-separated list of label names, e.g.,
597-
'bug,ui,@high'
598-
:param str sort: accepted values: ('created', 'updated', 'comments')
599-
api-default: created
600-
:param str direction: accepted values: ('asc', 'desc')
601-
api-default: desc
602-
:param str since: ISO 8601 formatted timestamp, e.g.,
603-
2012-05-20T23:10:27Z
604-
:returns: list of :class:`Issue <github3.issues.Issue>`\ s
605-
"""
606-
issues= []
607-
ifownerandrepository:
608-
repo=self.repository(owner,repository)
609-
issues=repo.list_issues(milestone,state,assignee,mentioned,
610-
labels,sort,direction,since)
611-
returnissues
612-
613477
defiter_repo_issues(self,owner,repository,milestone=None,
614478
state='',assignee='',mentioned='',labels='',sort='',direction='',
615479
since='',number=-1):
@@ -642,16 +506,6 @@ def iter_repo_issues(self, owner, repository, milestone=None,
642506
labels,sort,direction,since,number)
643507
returnself._iter(0,'',type)
644508

645-
@requires_auth
646-
deflist_keys(self):
647-
"""List public keys for the authenticated user.
648-
649-
:returns: list of :class:`Key <github3.users.Key>`\ s
650-
"""
651-
url=self._build_url('user','keys')
652-
json=self._json(self._get(url),200)
653-
return [Key(key,self)forkeyinjson]
654-
655509
@requires_auth
656510
defiter_keys(self,number=-1):
657511
"""Iterate over public keys for the authenticated user.
@@ -663,23 +517,6 @@ def iter_keys(self, number=-1):
663517
url=self._build_url('user','keys')
664518
returnself._iter(int(number),url,Key)
665519

666-
deflist_orgs(self,login=None):
667-
"""List public organizations for login if provided; otherwise
668-
list public and private organizations for the authenticated
669-
user.
670-
671-
:param login: (optional), user whose orgs you wish to list
672-
:type login: str
673-
:returns: list of :class:`Organization <github3.orgs.Organization>`\ s
674-
"""
675-
iflogin:
676-
url=self._build_url('users',login,'orgs')
677-
else:
678-
url=self._build_url('user','orgs')
679-
680-
json=self._json(self._get(url),200)
681-
return [Organization(org,self)fororginjson]
682-
683520
defiter_orgs(self,login=None,number=-1):
684521
"""Iterate over public organizations for login if provided; otherwise
685522
iterate over public and private organizations for the authenticated
@@ -698,45 +535,6 @@ def iter_orgs(self, login=None, number=-1):
698535

699536
returnself._iter(int(number),url,Organization)
700537

701-
deflist_repos(self,login=None,type='',sort='',direction=''):
702-
"""List public repositories for the specified ``login`` or all
703-
repositories for the authenticated user if ``login`` is not
704-
provided.
705-
706-
:param login: (optional)
707-
:type login: str
708-
:param type: (optional), accepted values:
709-
('all', 'owner', 'public', 'private', 'member')
710-
API default: 'all'
711-
:type type: str
712-
:param sort: (optional), accepted values:
713-
('created', 'updated', 'pushed', 'full_name')
714-
API default: 'created'
715-
:type sort: str
716-
:param direction: (optional), accepted values:
717-
('asc', 'desc'), API default: 'asc' when using 'full_name',
718-
'desc' otherwise
719-
:type direction: str
720-
:returns: list of :class:`Repository <github3.repos.Repository>`
721-
objects
722-
"""
723-
iflogin:
724-
url=self._build_url('users',login,'repos')
725-
else:
726-
url=self._build_url('user','repos')
727-
728-
params= {}
729-
iftypein ('all','owner','public','private','member'):
730-
params.update(type=type)
731-
ifnotlogin:
732-
ifsortin ('created','updated','pushed','full_name'):
733-
params.update(sort=sort)
734-
ifdirectionin ('asc','desc'):
735-
params.update(direction=direction)
736-
737-
json=self._json(self._get(url,params=params),200)
738-
return [Repository(repo,self)forrepoinjson]
739-
740538
defiter_repos(self,login=None,type='',sort='',direction='',
741539
number=-1):
742540
"""List public repositories for the specified ``login`` or all
@@ -779,18 +577,6 @@ def iter_repos(self, login=None, type='', sort='', direction='',
779577

780578
returnself._iter(int(number),url,Repository,params=params)
781579

782-
deflist_starred(self,login=None):
783-
"""List repositories starred by ``login`` or the authenticated user.
784-
785-
:returns: list of :class:`Repository <github3.repos.Repository>`
786-
"""
787-
iflogin:
788-
returnself.user(login).list_starred()
789-
790-
url=self._build_url('user','starred')
791-
json=self._json(self._get(url),200)
792-
return [Repository(r,self)forrinjson]
793-
794580
defiter_starred(self,login=None,number=-1):
795581
"""Iterate over repositories starred by ``login`` or the authenticated
796582
user.
@@ -805,19 +591,6 @@ def iter_starred(self, login=None, number=-1):
805591
url=self._build_url('user','starred')
806592
returnself._iter(int(number),url,Repository)
807593

808-
deflist_subscribed(self,login=None):
809-
"""List repositories subscribed to by ``login`` or the authenticated
810-
user.
811-
812-
:returns: list of :class:`Repository <github3.repos.Repository>`
813-
"""
814-
iflogin:
815-
returnself.user(login).list_subscriptions()
816-
817-
url=self._build_url('user','subscriptions')
818-
json=self._json(self._get(url),200)
819-
return [Repository(r,self)forrinjson]
820-
821594
defiter_subscribed(self,login=None,number=-1):
822595
"""Iterate over repositories subscribed to by ``login`` or the
823596
authenticated user.
@@ -832,10 +605,6 @@ def iter_subscribed(self, login=None, number=-1):
832605
url=self._build_url('user','subscriptions')
833606
returnself._iter(int(number),url,Repository)
834607

835-
deflist_watching(self,login=None):
836-
"""DEPRECATED: Use list_starred() instead."""
837-
raiseDeprecationWarning('Use list_starred() instead.')
838-
839608
deflogin(self,username=None,password=None,token=None):
840609
"""Logs the user into GitHub for protected API calls.
841610

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp