Small clean-up + type fixes

This commit is contained in:
Vincent Jacques
2012-07-10 20:37:49 +01:00
parent d40bec470e
commit 5cbee7346f
3 changed files with 10 additions and 7 deletions
+3 -3
View File
@@ -62,15 +62,15 @@ API `/legacy/issues/search/:owner/:repository/:state/:keyword`
* GET: `Repository.search_issues`
API `/legacy/repos/search/:keyword`
==============================================================
===================================
* GET: `Github.search_repos`
API `/legacy/user/search/:keyword`
==============================================================
==================================
* GET: `Github.search_users`
API `/legacy/user/email/:email`
==============================================================
===============================
* GET: `Github.search_user_by_email`
API `/networks/:user/:repo/events`
+1 -1
View File
@@ -27,7 +27,7 @@ Methods
* `get_user( login )`: `NamedUser`
* `get_organization( login )`: `Organization`
* `get_gist( id )`: `Gist`
* `id`: integer
* `id`: string
* `get_gists()`: iterator of `Gist`
* `search_repos( keyword )`: iterator of `Repository`
* `legacy_search_repos( keyword, [language] )`: iterator of `Repository`
+6 -3
View File
@@ -31,8 +31,9 @@ class Github( object ):
def rate_limiting( self ):
return self.__requester.rate_limiting
def get_user( self, login = None ):
if login is None:
def get_user( self, login = GithubObject.NotSet ):
assert login is GithubObject.NotSet or isinstance( login, ( str, unicode ) ), login
if login is GithubObject.NotSet:
return AuthenticatedUser.AuthenticatedUser( self.__requester, { "url": "https://api.github.com/user" }, completed = False )
else:
headers, data = self.__requester.requestAndCheck(
@@ -44,6 +45,7 @@ class Github( object ):
return NamedUser.NamedUser( self.__requester, data, completed = True )
def get_organization( self, login ):
assert isinstance( login, ( str, unicode ) ), login
headers, data = self.__requester.requestAndCheck(
"GET",
"https://api.github.com/orgs/" + login,
@@ -53,9 +55,10 @@ class Github( object ):
return Organization.Organization( self.__requester, data, completed = True )
def get_gist( self, id ):
assert isinstance( id, ( str, unicode ) ), id
headers, data = self.__requester.requestAndCheck(
"GET",
"https://api.github.com/gists/" + str( id ),
"https://api.github.com/gists/" + id,
None,
None
)