<commit_before>import sys
import re

"""
To do:
	- Add web interaction to get the string argument
directly from web instead of having to manually put the 
argument as a command line argument

"""

try:
	dates = sys.argv[1]
	listDates = dates.split('\n')
	xfConsumptionRegex = re.compile(r'[\d,]+$')

	xfConsumptionWeekly = [int(re.sub(r',', '', re.search(xfConsumptionRegex, i).group())) for i in listDates]

	sumXFConsumption = sum(xfConsumptionWeekly)

#print("List of Dates")
#print(listDates)
	print("XF Consumption List")
	print(xfConsumptionWeekly)
	print("Sum of XF Consumption")
	print(sumXFConsumption)
except IndexError:
	print("""At least one argument required.
Example:

05 Jul 2015 1,546   10,260  0   11,806
06 Jul 2015 1,520   10,260  0   11,780
07 Jul 2015 1,530   10,247  0   11,777
08 Jul 2015 1,524   10,257  0   11,781
09 Jul 2015 1,516   10,261  0   11,777
10 Jul 2015 1,494   10,209  0   11,703
11 Jul 2015 1,506   10,272  0   11,778
12 Jul 2015 1,470   10,193  0   11,663""")
<commit_msg>Add try/catch<commit_after>import sys
import re

"""
To do:
	- Add web interaction to get the string argument
directly from web instead of having to manually put the 
argument as a command line argument

"""

try:
	dates = sys.argv[1]
	listDates = dates.split('\n')
	xfConsumptionRegex = re.compile(r'(?P<xfConsumption>[\d,]+$)')
    # Only the last digits are grouped, the comma is removed, and converted to int
	xfConsumptionWeekly = [int(re.sub(r',', '', re.search(xfConsumptionRegex, i).group('xfConsumption'))) for i in listDates]

	sumXFConsumption = sum(xfConsumptionWeekly)

#print("List of Dates")
#print(listDates)
	print("XF Consumption List")
	print(xfConsumptionWeekly)
	print("Sum of XF Consumption")
	print(sumXFConsumption)
except IndexError:
	print("""At least one argument required.
Example:

05 Jul 2015 1,546   10,260  0   11,806
06 Jul 2015 1,520   10,260  0   11,780
07 Jul 2015 1,530   10,247  0   11,777
08 Jul 2015 1,524   10,257  0   11,781
09 Jul 2015 1,516   10,261  0   11,777
10 Jul 2015 1,494   10,209  0   11,703
11 Jul 2015 1,506   10,272  0   11,778
12 Jul 2015 1,470   10,193  0   11,663""")

{'fraction_non_alphanumeric': 0.1127221702525725, 'fraction_numerical': 0.1580916744621141, 'mean_word_length': 4.0329411764705885, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2178677', 'n_tokens_mistral': 1013, 'n_tokens_neox': 780, 'n_words': 263}