<commit_before>import random

from sugar.canvas import Colors

def _parse_string(color_string):
	if color_string == 'white':
		return ['#4f4f4f', 'white']

	splitted = color_string.split(',')
	if len(splitted) == 2:
		return [splitted[0], splitted[1]]
	else:
		return None

def is_valid(color_string):
	return (_parse_string(color_string) != None)

class IconColor:
	def __init__(self, color_string=None):
		if color_string == None or not is_valid(color_string):
			n = int(random.random() * (len(Colors.colors) - 1))
			[self._fill, self._stroke] = Colors.colors[n]
		else:
			[self._fill, self._stroke] = _parse_string(color_string)

	def get_stroke_color(self):
		return self._stroke

	def get_fill_color(self):
		return self._fill

	def to_string(self):
		return '%s,%s' % (self._fill, self._stroke)
<commit_msg>Urgh I had fill/stroke inverted, no wonder I was getting ugly colors!<commit_after>import random

from sugar.canvas import Colors

def _parse_string(color_string):
	if color_string == 'white':
		return ['#4f4f4f', 'white']

	splitted = color_string.split(',')
	if len(splitted) == 2:
		return [splitted[0], splitted[1]]
	else:
		return None

def is_valid(color_string):
	return (_parse_string(color_string) != None)

class IconColor:
	def __init__(self, color_string=None):
		if color_string == None or not is_valid(color_string):
			n = int(random.random() * (len(Colors.colors) - 1))
			[self._stroke, self._fill] = Colors.colors[n]
		else:
			[self._stroke, self._fill] = _parse_string(color_string)

	def get_stroke_color(self):
		return self._stroke

	def get_fill_color(self):
		return self._fill

	def to_string(self):
		return '%s,%s' % (self._fill, self._stroke)

{'fraction_non_alphanumeric': 0.13566350710900474, 'fraction_numerical': 0.008293838862559242, 'mean_word_length': 5.053763440860215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6507892', 'n_tokens_mistral': 647, 'n_tokens_neox': 605, 'n_words': 143}