Skip to content

Commit 94e7c97

Browse files
committed
Add a class to encapsulate these results
1 parent fe28ba8 commit 94e7c97

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

github3/search/code.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from github3.models import GitHubCore
2+
from github3.repos import Repository
3+
4+
5+
class CodeSearchResult(GitHubCore):
6+
def __init__(self, data, session=None):
7+
super(CodeSearchResult, self).__init__(data, session)
8+
self._api = data.get('url')
9+
#: Filename the match occurs in
10+
self.name = data.get('name')
11+
#: Path in the repository to the file
12+
self.path = data.get('path')
13+
#: SHA in which the code can be found
14+
self.sha = data.get('sha')
15+
#: URL to the Git blob endpoint
16+
self.git_url = data.get('git_url')
17+
#: URL to the HTML view of the blob
18+
self.html_url = data.get('html_url')
19+
#: Repository the code snippet belongs to
20+
self.repository = Repository(data.get('repository', {}), self)
21+
#: Score of the result
22+
self.score = data.get('score')
23+
#: Text matches
24+
self.text_matches = data.get('text_matches', [])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy