From 87ad0f3080f0fceb0031d7be43f0ac53e9277ddc Mon Sep 17 00:00:00 2001 From: A_D <aunderscored@gmail.com> Date: Fri, 10 Jul 2020 05:46:22 +0200 Subject: [PATCH] Replaced or magic with multiline if Abusing ors for that is incredibly confusing. Additionally, I replaced the .join() call with a static .format call, as the join is confusing for no reason --- edshipyard.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/edshipyard.py b/edshipyard.py index c6f5fa00..4b7c1b13 100644 --- a/edshipyard.py +++ b/edshipyard.py @@ -149,7 +149,14 @@ def export(data, filename=None): # Construct description ship = ship_map.get(data['ship']['name'].lower(), data['ship']['name']) - string = '[%s]\n' % (data['ship'].get('shipName') and ', '.join([ship, data['ship']['shipName']]) or ship) + + if data['ship'].get('shipName') is not None: + _ships = '{}, {}'.format(ship, data['ship']['shipName']) + else: + _ships = ship + + string = '[{}]\n'.format(_ships) + for slot in ['H', 'L', 'M', 'S', 'U', None, 'BH', 'RB', 'TM', 'FH', 'EC', 'PC', 'SS', 'FS', None, 'MC', None, '9', '8', '7', '6', '5', '4', '3', '2', '1']: if not slot: string += '\n'