Kami commented on a change in pull request #1469:
URL: https://github.com/apache/libcloud/pull/1469#discussion_r453204143
##########
File path: contrib/scrape-ec2-prices.py
##########
@@ -234,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,
Review comment:
This function is repeated across multiple scripts so eventually we
should refactor it in some common place.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]