Fix sorting function.
@@ -267,15 +267,20 @@ def sort_key_by_numeric_other(key_value):
"""
Split key into numeric, alpha and other part and sort accordingly.
"""
- return tuple((
- int(numeric) if numeric else None,
- INSTANCE_SIZES.index(alpha) if alpha in INSTANCE_SIZES else alpha,
- other
- ) for (numeric, alpha, other) in RE_NUMERIC_OTHER.findall(key_value[0]))
+ result = []
+
+ for (numeric, alpha, other) in RE_NUMERIC_OTHER.findall(key_value[0]):
+ numeric = int(numeric) if numeric else -1
+ alpha = INSTANCE_SIZES.index(alpha) if alpha in INSTANCE_SIZES else alpha
+ alpha = str(alpha)
+ item = tuple([numeric, alpha, other])
+ result.append(item)
+
+ return tuple(result)
def main():
- print('Scraping EC2 pricing data')
+ print('Scraping EC2 pricing data (this may take up to 2 minutes)....')
pricing_data = scrape_ec2_pricing()
update_pricing_file(pricing_file_path=PRICING_FILE_PATH,
