<commit_before>
class Error(Exception):
	def __init__(self, node, msg):
		self.node = node
		self.msg = msg
	def show(self, fn):
		pos = self.node.pos
		a = '%s [%s.%s]: %s' % (fn, pos[0][0] + 1, pos[0][1] + 1, self.msg)
		b = pos[2].replace('\t', ' ' * 4).rstrip()
		mv = -1 if '\t' in pos[2] else 0
		c = ' ' * (mv + pos[0][1] + 4 * pos[2].count('\t')) + '^'
		return '\n'.join((a, b, c)) + '\n'<commit_msg>Show best-effort error message if no position is available.<commit_after>
class Error(Exception):
	
	def __init__(self, node, msg):
		self.node = node
		self.msg = msg
	
	def show(self, fn):
		
		if self.node.pos is None:
			return '%s: %s\n' % (fn, self.msg)
		
		pos = self.node.pos
		a = '%s [%s.%s]: %s' % (fn, pos[0][0] + 1, pos[0][1] + 1, self.msg)
		b = pos[2].replace('\t', ' ' * 4).rstrip()
		mv = -1 if '\t' in pos[2] else 0
		c = ' ' * (mv + pos[0][1] + 4 * pos[2].count('\t')) + '^'
		return '\n'.join((a, b, c)) + '\n'
{'fraction_non_alphanumeric': 0.2553191489361702, 'fraction_numerical': 0.031914893617021274, 'mean_word_length': 2.8565573770491803, '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': '1247569', 'n_tokens_mistral': 453, 'n_tokens_neox': 415, 'n_words': 110}