<commit_before>import logging

class DStar:

	stream = {}
	logger = None

	free_text_sequence = ['', '@', 'A', 'B', 'C']

	def __init__(self):
		self.logger = logging.getLogger(__name__)

	def valid_nmea_sentence(self, sentence):
		try:
			if sentence[:3] == "$GP":
				to_verify = sentence[1:-3]
				crc = 0
				for i in range(0, len(to_verify)):
					crc = crc ^ ord(to_verify[i])
				if crc == int(sentence[-2:], 16):
					return True
			return False
		except ValueError:
			return False

	def valid_dprs_sentence(self, sentence):
		icomcrc = 0xffff
		for l in range(0, len(sentence)):
			ch = ord(sentence[l]) & 0xff
			for i in range(0, 8):
				xorflag = ((icomcrc ^ ch) & 0x01) == 0x01
				icomcrc = icomcrc >> 1
				if xorflag:
					icomcrc = icomcrc ^ 0x8408
				ch = ch >> 1
		return hex((~icomcrc) & 0xffff)

	def valid_free_text_sequence(self, last_letter, current_letter):<commit_msg>Check for a valid dprs sentence!<commit_after>import logging

class DStar:

	stream = {}
	logger = None

	free_text_sequence = ['', '@', 'A', 'B', 'C']

	def __init__(self):
		self.logger = logging.getLogger(__name__)

	def valid_nmea_sentence(self, sentence):
		try:
			if sentence[:3] == "$GP":
				to_verify = sentence[1:-3]
				crc = 0
				for i in range(0, len(to_verify)):
					crc = crc ^ ord(to_verify[i])
				if crc == int(sentence[-2:], 16):
					return True
			return False
		except ValueError:
			return False

	def valid_dprs_sentence(self, sentence):
		icomcrc = 0xffff
		for l in range(0, len(sentence)):
			ch = ord(sentence[l]) & 0xff
			for i in range(0, 8):
				xorflag = ((icomcrc ^ ch) & 0x01) == 0x01
				icomcrc = icomcrc >> 1
				if xorflag:
					icomcrc = icomcrc ^ 0x8408
				ch = ch >> 1
		return '$$CRC' + str(hex((~icomcrc) & 0xffff)).upper() == sentence.split(",")[0]

	def valid_free_text_sequence(self, last_letter, current_letter):
{'fraction_non_alphanumeric': 0.1478494623655914, 'fraction_numerical': 0.02956989247311828, 'mean_word_length': 3.409952606635071, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, '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': '1860673', 'n_tokens_mistral': 870, 'n_tokens_neox': 710, 'n_words': 180}