Skip to content

Commit 4a0bddd

Browse files
committed
Fix issue with determining correct max page count from GitHub response.
1 parent 0c7584f commit 4a0bddd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

codesurvey/sources/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def _search_repos(self, *, page: int = 1) -> dict:
318318
return {
319319
# Return the total number of result pages that can be
320320
# sampled from.
321-
'page_count': max(self.MAX_RESULTS, r_json['total_count']) / self.REPOS_PER_PAGE,
321+
'page_count': min(self.MAX_RESULTS, r_json['total_count']) / self.REPOS_PER_PAGE,
322322
# Restrict the list of returned repos to those that
323323
# have the (optionally) specified language.
324324
'repos': [
@@ -357,7 +357,7 @@ def repo_generator(self) -> Iterator[RepoThunk]:
357357
while True:
358358
logger.info(f'Source "{self}" searching GitHub for repos')
359359
search_result = self._search_repos(page=rng.randint(1, page_count))
360-
page_count = search_result['page_count']
360+
page_count = int(search_result['page_count'])
361361
for repo_data in search_result['repos']:
362362
yield self.repo_thunk(
363363
key=repo_data['full_name'],

0 commit comments

Comments
 (0)