From 4f95a814c007577cc6c25ba28a0df7c2a8b93970 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 6 Jul 2016 14:10:02 -0400 Subject: [PATCH] satisfy the pylint gods --- endpoints/v1/registry.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/endpoints/v1/registry.py b/endpoints/v1/registry.py index 5bcdd89aa..0d6f5236b 100644 --- a/endpoints/v1/registry.py +++ b/endpoints/v1/registry.py @@ -1,26 +1,27 @@ import logging import json -from flask import make_response, request, session, Response, redirect, abort as flask_abort from functools import wraps from datetime import datetime from time import time +from flask import make_response, request, session, Response, redirect, abort as flask_abort + from app import storage as store, app from auth.auth import process_auth, extract_namespace_repo_from_session from auth.auth_context import get_authenticated_user -from auth.registry_jwt_auth import get_granted_username -from digest import checksums -from util.http import abort, exact_abort -from util.registry.filelike import SocketReader from auth.permissions import (ReadRepositoryPermission, ModifyRepositoryPermission) +from auth.registry_jwt_auth import get_granted_username from data import model, database -from util.registry import gzipstream -from util.registry.torrent import PieceHasher +from digest import checksums from endpoints.v1 import v1_bp from endpoints.decorators import anon_protect +from util.http import abort, exact_abort +from util.registry.filelike import SocketReader +from util.registry import gzipstream from util.registry.replication import queue_storage_replication +from util.registry.torrent import PieceHasher logger = logging.getLogger(__name__) @@ -38,7 +39,7 @@ def set_uploading_flag(repo_image, is_image_uploading): repo_image.storage.save() -def _finish_image(namespace, repository, repo_image): +def _finish_image(namespace, repo_image): # Checksum is ok, we remove the marker set_uploading_flag(repo_image, False) @@ -176,7 +177,7 @@ def put_image_layer(namespace, repository, image_id): logger.debug('Retrieving image data') uuid = repo_image.storage.uuid json_data = repo_image.v1_json_metadata - except (AttributeError): + except AttributeError: logger.exception('Exception when retrieving image data') abort(404, 'Image %(image_id)s not found', issue='unknown-image', image_id=image_id) @@ -235,7 +236,8 @@ def put_image_layer(namespace, repository, image_id): size_info.compressed_size, size_info.uncompressed_size) pieces_bytes = piece_hasher.final_piece_hashes() - model.storage.save_torrent_info(updated_storage, app.config['BITTORRENT_PIECE_SIZE'], pieces_bytes) + model.storage.save_torrent_info(updated_storage, app.config['BITTORRENT_PIECE_SIZE'], + pieces_bytes) # Append the computed checksum. csums = [] @@ -266,7 +268,7 @@ def put_image_layer(namespace, repository, image_id): issue='checksum-mismatch', image_id=image_id) # Mark the image as uploaded. - _finish_image(namespace, repository, repo_image) + _finish_image(namespace, repo_image) return make_response('true', 200) @@ -330,7 +332,7 @@ def put_image_checksum(namespace, repository, image_id): issue='checksum-mismatch', image_id=image_id) # Mark the image as uploaded. - _finish_image(namespace, repository, repo_image) + _finish_image(namespace, repo_image) return make_response('true', 200)