Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
utils: @pypingou suggested to simplify the lambda statement
Browse files Browse the repository at this point in the history
Signed-off-by: Sayan Chowdhury <[email protected]>
  • Loading branch information
sayanchowdhury committed Dec 11, 2017
1 parent e427542 commit 1df64ec
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions fedimg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,13 @@ def get_image_name_from_image(image_url, virt_type='', region='', respin='0',
file_name = get_file_name_image(image_url)
build_name = file_name.replace('.raw.xz', '')

return '-'.join(filter(lambda x: x, [
build_name,
virt_type,
region,
volume_type,
respin]
))
return '-'.join(
[x for x in [build_name, virt_type, region, volume_type, respin] if x])


def get_image_name_from_ami_name(image_name, region):
name_vt_region, volume_type, respin = image_name.rsplit('-', 2)
name_vt = name_vt_region.rsplit('-', 3)[:-3][0]

return '-'.join(filter(lambda x: x, [
name_vt,
region,
volume_type,
respin]
))

return '-'.join(
[x for x in [name_vt, region, volume_type, respin] if x])

0 comments on commit 1df64ec

Please sign in to comment.