<commit_before>import Rover3
import serial
import time
import datetime
import os
import thread
import sys
print('Starting...')
try:
	port = sys.argv[1]
except:
	port = '/dev/ttyAMA0'

ser = serial.Serial(port, 57600, timeout=1.5) #Create a serial object
ser.readline() #Let the protocol handshake...

state = 'ON' #State of the mainloop

Rover = Rover3.Rover3() #Make an instance of the 'Rover' class


f = ''
def update():
	try:
		while True:
			rdln = ser.readline()
			if rdln != 'BREAK serial':
				if rdln != 'REC start' or rdln != 'REC end':
					Rover.data = rdln
					Rover.parse()
			if rdln == 'BREAK serial':
				state == 'OFF'
				ser.write('BREAK serial confirm')
				print('Ending (got "BREAK serial")...')
				sys.exit(0)
	except KeyboardInterrupt:
		f.close()
		ser.close()
		print('Ending (got KeyboardInterrupt)...')
		sys.exit(0)
def mainloop():
	f = open(os.getcwd()+'/log/'+datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S.log'), 'w')
	while state=='ON':
		try:
			time.sleep(10)	<commit_msg>Fixed IOError<commit_after>import Rover3
import serial
import time
import datetime
import os
import thread
import sys
print('Starting...')
try:
	port = sys.argv[1]
except:
	port = '/dev/ttyAMA0'

ser = serial.Serial(port, 57600, timeout=1.5) #Create a serial object
ser.readline() #Let the protocol handshake...

state = 'ON' #State of the mainloop

Rover = Rover3.Rover3() #Make an instance of the 'Rover' class


f = ''
def update():
	try:
		while True:
			rdln = ser.readline()
			if rdln != 'BREAK serial':
				if rdln != 'REC start' or rdln != 'REC end':
					Rover.data = rdln
					Rover.parse()
			if rdln == 'BREAK serial':
				state == 'OFF'
				ser.write('BREAK serial confirm')
				print('Ending (got "BREAK serial")...')
				sys.exit(0)
	except KeyboardInterrupt:
		f.close()
		ser.close()
		print('Ending (got KeyboardInterrupt)...')
		sys.exit(0)
def mainloop():
	try:
		f = open(os.getcwd()+'/log/'+datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S.log'), 'w')
	except IOError:
		os.system('mkdir ./log/')
		f = open(os.getcwd()+'/log/'+datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S.log'), 'w')
	while state=='ON':
		try:
			time.sleep(10)	
{'fraction_non_alphanumeric': 0.1794401101422671, 'fraction_numerical': 0.014685635612666361, 'mean_word_length': 3.570230607966457, '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': '3264608', 'n_tokens_mistral': 936, 'n_tokens_neox': 816, 'n_words': 215}