Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/github/lister.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def get_next_target_from_response(self, response): | ||||
return int(self.API_URL_INDEX_RE.match(next_url).group(1)) | return int(self.API_URL_INDEX_RE.match(next_url).group(1)) | ||||
def transport_response_simplified(self, response): | def transport_response_simplified(self, response): | ||||
repos = response.json() | repos = response.json() | ||||
return [self.get_model_from_repo(repo) for repo in repos] | return [self.get_model_from_repo(repo) for repo in repos] | ||||
def request_headers(self): | def request_headers(self): | ||||
return {'Accept': 'application/vnd.github.v3+json'} | return {'Accept': 'application/vnd.github.v3+json'} | ||||
def disable_deleted_repo_tasks(self, index, next_index, keep_these): | |||||
""" (Overrides) Fix provided index value to avoid erroneously disabling | |||||
some scheduler tasks | |||||
""" | |||||
# Next listed repository ids are strictly greater than the 'since' | |||||
# parameter, so increment the index to avoid disabling the latest | |||||
# created task when processing a new repositories page returned by | |||||
# the Github API | |||||
return super().disable_deleted_repo_tasks(index + 1, next_index, | |||||
keep_these) |