style(data, endpoints, test): ran yapf against changed files

### Description of Changes

Issue: https://coreosdev.atlassian.net/browse/QUAY-633

## Reviewer Checklist

- [ ] It works!
- [ ] Comments provide sufficient explanations for the next contributor
- [ ] Tests cover changes and corner cases
- [ ] Follows Quay syntax patterns and format
This commit is contained in:
Charlton Austin 2017-07-24 11:05:15 -04:00
parent 9e1106f164
commit 8f1200b00d
7 changed files with 871 additions and 1332 deletions

View file

@ -79,11 +79,9 @@ class PreOCIModel(RepositoryDataInterface):
# Also note the +1 on the limit, as paginate_query uses the extra result to determine whether
# there is a next page.
start_id = model.modelutil.pagination_start(page_token)
repo_query = model.repository.get_visible_repositories(username=username,
include_public=public,
start_id=start_id,
limit=REPOS_PER_PAGE + 1,
kind_filter=repo_kind)
repo_query = model.repository.get_visible_repositories(
username=username, include_public=public, start_id=start_id, limit=REPOS_PER_PAGE + 1,
kind_filter=repo_kind)
repos, next_page_token = model.modelutil.paginate_query(repo_query, limit=REPOS_PER_PAGE,
id_alias='rid')
@ -139,29 +137,30 @@ class PreOCIModel(RepositoryDataInterface):
is_starred = model.repository.repository_is_starred(user, repo) if user else False
is_public = model.repository.is_repository_public(repo)
base = RepositoryBaseElement(namespace_name, repository_name, is_starred, is_public, repo.kind.name,
repo.description, repo.namespace_user.organization,
repo.namespace_user.removed_tag_expiration_s, None, None)
base = RepositoryBaseElement(
namespace_name, repository_name, is_starred, is_public, repo.kind.name, repo.description,
repo.namespace_user.organization, repo.namespace_user.removed_tag_expiration_s, None, None,
False, False, False)
# Note: This is *temporary* code for the new OCI model stuff.
if base.kind_name == 'application':
channels = oci_model.channel.get_repo_channels(repo)
releases = oci_model.release.get_release_objs(repo)
return ApplicationRepository(base,
[Channel(channel.name, channel.linked_tag.name, channel.linked_tag.lifetime_start)
for channel in channels],
[Release(release.name, release.released, release.lifetime_start)
for release in releases])
releases_channels_map = defaultdict(list)
return ApplicationRepository(
base, [create_channel(channel, releases_channels_map) for channel in channels], [
Release(release.name, release.released, release.lifetime_start, releases_channels_map)
for release in releases
])
tags = model.tag.list_active_repo_tags(repo)
start_date = datetime.now() - timedelta(days=MAX_DAYS_IN_3_MONTHS)
counts = model.log.get_repository_action_counts(repo, start_date)
return NonApplicationRepository(base,
[Tag(tag.name, tag.image.docker_image_id, tag.image.aggregate_size,
tag.lifetime_start_ts, tag.tagmanifest.digest) for tag in tags],
[Count(count.date, count.count) for count in counts],
repo.badge_token, repo.trust_enabled)
return ImageRepositoryRepository(base, [
Tag(tag.name, tag.image.docker_image_id, tag.image.aggregate_size, tag.lifetime_start_ts,
tag.tagmanifest.digest) for tag in tags
], [Count(count.date, count.count) for count in counts], repo.badge_token, repo.trust_enabled)
pre_oci_model = PreOCIModel()