Skip to content

Commit f5e7a29

Browse files
committed
Use a IssueSearchResult
1 parent 14750c8 commit f5e7a29

4 files changed

Lines changed: 33 additions & 30 deletions

File tree

github3/api.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -425,27 +425,26 @@ def search_issues(query, sort=None, order=None, per_page=None,
425425
The query can contain any combination of the following supported
426426
qualifers:
427427
428-
- ``in`` Qualifies which fields are searched. With this qualifier you
429-
can restrict the search to just the repository name, description,
430-
readme, or any combination of these.
431428
- ``type`` With this qualifier you can restrict the search to issues or
432-
pull request only.
429+
pull request only.
430+
- ``in`` Qualifies which fields are searched. With this qualifier you can
431+
restrict the search to just the title, body, comments, or any
432+
combination of these.
433433
- ``author`` Finds issues created by a certain user.
434434
- ``assignee`` Finds issues that are assigned to a certain user.
435435
- ``mentions`` Finds issues that mention a certain user.
436436
- ``commenter`` Finds issues that a certain user commented on.
437437
- ``involves`` Finds issues that were either created by a certain user,
438-
assigned to that user, mention that user, or were commented on by that
439-
user.
440-
- ``created`` or ``updated`` Filters issues based on times of
441-
creation, or when they were last updated. Format: ``YYYY-MM-DD``.
442-
Examples: ``created:<2011``, ``pushed:<2013-02``,
443-
``pushed:>=2013-03-06``
444-
- ``user`` or ``repo`` Limits searches to a specific user or repository.
438+
assigned to that user, mention that user, or were commented on by that
439+
user.
440+
- ``state`` Filter issues based on whether they’re open or closed.
441+
- ``labels`` Filters issues based on their labels.
445442
- ``language`` Searches for issues within repositories that match a
446-
certain language.
443+
certain language.
444+
- ``created`` or ``updated`` Filters issues based on times of creation, or
445+
when they were last updated.
447446
- ``comments`` Filters issues based on the quantity of comments.
448-
- ``labels`` Filters issues based on their labels.
447+
- ``user`` or ``repo`` Limits searches to a specific user or repository.
449448
450449
For more information about these qualifiers, see: http://git.io/d1oELA
451450
@@ -461,7 +460,8 @@ def search_issues(query, sort=None, order=None, per_page=None,
461460
:param int number: (optional), number of issues to return.
462461
Default: -1, returns all available issues
463462
:param str etag: (optional), previous ETag header value
464-
:return: generator of :class:`Issue <github3.issues.Issue>`
463+
:return: generator of :class:`IssueSearchResult
464+
<github3.search.IssueSearchResult>`
465465
"""
466466
return gh.search_issues(query, sort, order, per_page, text_match,
467467
number, etag)

github3/github.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from github3.models import GitHubCore
1818
from github3.orgs import Organization
1919
from github3.repos import Repository
20-
from github3.search import CodeSearchResult, RepositorySearchResult
20+
from github3.search import (CodeSearchResult, IssueSearchResult,
21+
RepositorySearchResult)
2122
from github3.structs import SearchIterator
2223
from github3.users import User, Key
2324
from github3.notifications import Thread
@@ -1049,27 +1050,27 @@ def search_issues(self, query, sort=None, order=None, per_page=None,
10491050
The query can contain any combination of the following supported
10501051
qualifers:
10511052
1053+
- ``type`` With this qualifier you can restrict the search to issues
1054+
or pull request only.
10521055
- ``in`` Qualifies which fields are searched. With this qualifier you
1053-
can restrict the search to just the repository name, description,
1054-
readme, or any combination of these.
1055-
- ``type`` With this qualifier you can restrict the search to issues or
1056-
pull request only.
1056+
can restrict the search to just the title, body, comments, or any
1057+
combination of these.
10571058
- ``author`` Finds issues created by a certain user.
10581059
- ``assignee`` Finds issues that are assigned to a certain user.
10591060
- ``mentions`` Finds issues that mention a certain user.
10601061
- ``commenter`` Finds issues that a certain user commented on.
10611062
- ``involves`` Finds issues that were either created by a certain user,
10621063
assigned to that user, mention that user, or were commented on by
10631064
that user.
1064-
- ``created`` or ``updated`` Filters issues based on times of
1065-
creation, or when they were last updated. Format: ``YYYY-MM-DD``.
1066-
Examples: ``created:<2011``, ``pushed:<2013-02``,
1067-
``pushed:>=2013-03-06``
1068-
- ``user`` or ``repo`` Limits searches to a specific user or repository
1065+
- ``state`` Filter issues based on whether they’re open or closed.
1066+
- ``labels`` Filters issues based on their labels.
10691067
- ``language`` Searches for issues within repositories that match a
10701068
certain language.
1069+
- ``created`` or ``updated`` Filters issues based on times of creation,
1070+
or when they were last updated.
10711071
- ``comments`` Filters issues based on the quantity of comments.
1072-
- ``labels`` Filters issues based on their labels.
1072+
- ``user`` or ``repo`` Limits searches to a specific user or
1073+
repository.
10731074
10741075
For more information about these qualifiers, see: http://git.io/d1oELA
10751076
@@ -1086,7 +1087,8 @@ def search_issues(self, query, sort=None, order=None, per_page=None,
10861087
:param int number: (optional), number of issues to return.
10871088
Default: -1, returns all available issues
10881089
:param str etag: (optional), previous ETag header value
1089-
:return: generator of :class:`Issue <github3.issues.Issue>`
1090+
:return: generator of :class:`IssueSearchResult
1091+
<github3.search.IssueSearchResult>`
10901092
"""
10911093
params = {'q': query}
10921094
headers = {}
@@ -1103,8 +1105,8 @@ def search_issues(self, query, sort=None, order=None, per_page=None,
11031105
}
11041106

11051107
url = self._build_url('search', 'issues')
1106-
return SearchIterator(number, url, Issue, self, params, etag,
1107-
headers)
1108+
return SearchIterator(number, url, IssueSearchResult, self, params,
1109+
etag, headers)
11081110

11091111
def search_repositories(self, query, sort=None, order=None,
11101112
per_page=None, text_match=False, number=-1,

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
2+
from .issue import IssueSearchResult
23
from .repository import RepositorySearchResult
34

45

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

tests/integration/test_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_search_issues(self):
228228
cassette_name = self.cassette_name('search_issues')
229229
with self.recorder.use_cassette(cassette_name):
230230
issues = self.gh.search_issues('github3 labels:bugs')
231-
assert isinstance(next(issues), github3.issues.issue.Issue)
231+
assert isinstance(next(issues), github3.search.IssueSearchResult)
232232

233233
assert isinstance(issues, github3.structs.SearchIterator)
234234

0 commit comments

Comments
 (0)