Unnecessary "else" after "return" (#115)

* Unnecessary "else" after "return"
This commit is contained in:
Juha Ylitalo
2024-02-23 20:47:23 +02:00
committed by GitHub
parent fb02b47053
commit 85bdf89027

View File

@@ -178,10 +178,9 @@ def get_auth_schemes(r,path):
if DEBUG: if DEBUG:
print('[debug][docker] Auth schemes found:{0}'.format([m for m in oauth])) print('[debug][docker] Auth schemes found:{0}'.format([m for m in oauth]))
return [m.lower() for m in oauth] return [m.lower() for m in oauth]
else: if DEBUG:
if DEBUG: print('[debug][docker] No Auth schemes found')
print('[debug][docker] No Auth schemes found') return []
return []
# class to manipulate registry # class to manipulate registry
class Registry: class Registry:
@@ -364,10 +363,7 @@ class Registry:
if json_result['schemaVersion'] == 1: if json_result['schemaVersion'] == 1:
print("Docker schemaVersion 1 isn't supported for deleting by age now") print("Docker schemaVersion 1 isn't supported for deleting by age now")
sys.exit(1) sys.exit(1)
else: return json_result['config']
tag_config = json_result['config']
return tag_config
def get_image_age(self, image_name, image_config): def get_image_age(self, image_name, image_config):
container_header = {"Accept": "{0}".format( container_header = {"Accept": "{0}".format(
@@ -393,10 +389,9 @@ class Registry:
self.last_error = None self.last_error = None
image_age = json.loads(response.text) image_age = json.loads(response.text)
return image_age['created'] return image_age['created']
else: print(" blob not found: {0}".format(self.last_error))
print(" blob not found: {0}".format(self.last_error)) self.last_error = response.status_code
self.last_error = response.status_code return []
return []
def parse_args(args=None): def parse_args(args=None):
@@ -681,10 +676,8 @@ def get_newer_tags(registry, image_name, hours, tags_list):
print("Keeping tag: {0} timestamp: {1}".format( print("Keeping tag: {0} timestamp: {1}".format(
tag, image_age)) tag, image_age))
return tag return tag
else: print("Will delete tag: {0} timestamp: {1}".format(tag, image_age))
print("Will delete tag: {0} timestamp: {1}".format( return None
tag, image_age))
return None
print('---------------------------------') print('---------------------------------')
p = ThreadPool(4) p = ThreadPool(4)