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

Commitc74e5c0

Browse files
committed
Update search submodule for consistency with docs
1 parentab727a1 commitc74e5c0

File tree

4 files changed

+97
-43
lines changed

4 files changed

+97
-43
lines changed

‎github3/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ def search_code(self, query, sort=None, order=None, per_page=None,
13201320

13211321
defsearch_issues(self,query,sort=None,order=None,per_page=None,
13221322
text_match=False,number=-1,etag=None):
1323-
"""Find issues by state and keyword
1323+
"""Find issues by state and keyword.
13241324
13251325
The query can contain any combination of the following supported
13261326
qualifers:

‎github3/search/code.py

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,65 @@
11
# -*- coding: utf-8 -*-
2+
"""Code search results implementation."""
23
from __future__importunicode_literals
34

45
from ..importmodels
56
from ..importrepos
67

78

89
classCodeSearchResult(models.GitHubCore):
10+
"""A representation of a code search result from the API.
911
10-
def_update_attributes(self,data):
11-
self._api=self._get_attribute(data,'url')
12+
This object has the following attributes:
13+
14+
.. attribute:: git_url
15+
16+
The URL to retrieve the blob via Git
17+
18+
.. attribute:: html_url
19+
20+
The URL to view the blob found in a browser.
21+
22+
.. attribute:: name
23+
24+
The name of the file where the search result was found.
1225
13-
#: Filename the match occurs in
14-
self.name=self._get_attribute(data,'name')
26+
.. attribute:: path
1527
16-
#: Path in the repository to the file
17-
self.path=self._get_attribute(data,'path')
28+
The path in the repository to the file containing the result.
1829
19-
#: SHA in which the code can be found
20-
self.sha=self._get_attribute(data,'sha')
30+
.. attribute:: repository
2131
22-
#: URL tothe Git blob endpoint
23-
self.git_url=self._get_attribute(data,'git_url')
32+
A :class:`~github3.repos.repo.ShortRepository` representingthe
33+
repository in which the result was found.
2434
25-
#: URL to the HTML view of the blob
26-
self.html_url=self._get_attribute(data,'html_url')
35+
.. attribute:: score
2736
28-
#: Repository the code snippet belongs to
29-
self.repository=self._class_attribute(
30-
data,'repository',repos.ShortRepository,self
31-
)
37+
The confidence score assigned to the result.
3238
33-
#: Score of the result
34-
self.score=self._get_attribute(data,'score')
39+
.. attribute:: sha
3540
36-
#: Text matches
37-
self.text_matches=self._get_attribute(data,'text_matches', [])
41+
The SHA1 of the blob in which the code can be found.
42+
43+
.. attribute:: text_matches
44+
45+
A list of the text matches in the blob that generated this result.
46+
47+
.. note::
48+
49+
To receive these, you must pass ``text_match=True`` to
50+
:meth:`~github3.github.GitHub.search_code`.
51+
"""
52+
53+
def_update_attributes(self,data):
54+
self._api=data['url']
55+
self.git_url=data['git_url']
56+
self.html_url=data['html_url']
57+
self.name=data['name']
58+
self.path=data['path']
59+
self.repository=repos.ShortRepository(data['repository'],self)
60+
self.score=data['score']
61+
self.sha=data['sha']
62+
self.text_matches=data.get('text_matches', [])
3863

3964
def_repr(self):
4065
return'<CodeSearchResult [{0}]>'.format(self.path)

‎github3/search/issue.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
# -*- coding: utf-8 -*-
2+
"""Issue search results implementation."""
23
from __future__importunicode_literals
34

45
from ..modelsimportGitHubCore
56
from ..issuesimportShortIssue
67

78

89
classIssueSearchResult(GitHubCore):
9-
def_update_attributes(self,data):
10-
result=data.copy()
10+
"""A representation of a search result containing an issue.
11+
12+
This object has the following attributes:
13+
14+
.. attribute:: issue
15+
16+
A :class:`~github3.issues.issue.ShortIssue` representing the issue
17+
found in this search result.
18+
19+
.. attribute:: score
1120
12-
#: Score of the result
13-
self.score=self._get_attribute(result,'score')
14-
if'score'inresult:
15-
delresult['score']
21+
The confidence score of this search result.
1622
17-
#: Text matches
18-
self.text_matches=self._get_attribute(result,'text_matches', [])
19-
if'text_matches'inresult:
20-
delresult['text_matches']
23+
.. attribute:: text_matches
2124
22-
#: Issue object
25+
A list of matches in the issue for this search result.
26+
27+
.. note::
28+
29+
To receive these, you must pass ``text_match=True`` to
30+
:meth:`~github3.github.GitHub.search_issues`.
31+
"""
32+
33+
def_update_attributes(self,data):
34+
result=data.copy()
35+
self.score=result.pop('score')
36+
self.text_matches=result.pop('text_matches', [])
2337
self.issue=ShortIssue(result,self)
2438

2539
def_repr(self):

‎github3/search/repository.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
11
# -*- coding: utf-8 -*-
2+
"""Repository search results implementation."""
23
from __future__importunicode_literals
34

45
from ..importmodels
56
from ..importrepos
67

78

89
classRepositorySearchResult(models.GitHubCore):
9-
def_update_attributes(self,data):
10-
result=data.copy()
10+
"""A representation of a search result containing a repository.
11+
12+
This object has the following attributes::
13+
14+
.. attribute:: repository
15+
16+
A :class:`~github3.repos.repo.ShortRepository` representing the
17+
repository found by the search.
18+
19+
.. attribute:: score
1120
12-
#: Score of the result
13-
self.score=self._get_attribute(result,'score')
14-
if'score'inresult:
15-
delresult['score']
21+
The confidence score of this search result.
1622
17-
#: Text matches
18-
self.text_matches=self._get_attribute(result,'text_matches', [])
19-
if'text_matches'inresult:
20-
delresult['text_matches']
23+
.. attribute:: text_matches
2124
22-
#: Repository object
25+
A list of the text matches in the repository that generated this
26+
result.
27+
28+
.. note::
29+
30+
To receive these, you must pass ``text_match=True`` to
31+
:meth:`~github3.github.GitHub.search_code`.
32+
"""
33+
34+
def_update_attributes(self,data):
35+
result=data.copy()
36+
self.score=result.pop('score')
37+
self.text_matches=result.pop('text_matches', [])
2338
self.repository=repos.ShortRepository(result,self)
2439

2540
def_repr(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp