10000 Add UserSearchResult · abesto/github3.py@dad88be · GitHub
[go: up one dir, main page]

Skip to content

Commit dad88be

Browse files
committed
Add UserSearchResult
1 parent b363299 commit dad88be

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

github3/search/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .code import CodeSearchResult
22
from .repository import RepositorySearchResult
3+
from .user import UserSearchResult
34

45

5-
__all__ = [CodeSearchResult, RepositorySearchResult]
6+
__all__ = [CodeSearchResult, RepositorySearchResult, UserSearchResult]

github3/search/user.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
from github3.models import GitHubCore
3+
from github3.users import User
4+
5+
6+
class UserSearchResult(GitHubCore):
7+
def __init__(self, data, session=None):
8+
super(UserSearchResult, self).__init__(data, session)
9+
result = data.copy()
10+
#: Score of this search result
11+
self.score = result.pop('score')
12+
#: Text matches
13+
self.text_matches = result.pop('text_matches', [])
14+
#: User object matching the search
15+
self.user = User(result, self)
16+
17+
def __repr__(self):
18+
return '<UserSearchResult [{0}]>'.format(self.user)

0 commit comments

Comments
 (0)
0