<commit_before>#!/usr/bin/env python
#encoding: utf8

import sys, rospy
from pimouse_ros.msg import LightSensorValues

def get_freq():
	f = rospy.get_param('lightsensors_freq', 10)
	try:
		if f <= 0.0:
			raise Exception()
	except:
		rospy.logerr("value error: lightsensors_freq")
		sys.exit(1)
	return f

if __name__ == '__main__':
	devfile = "/dev/rtlightsensor0"
	rospy.init_node("lightsensors")
	pub = rospy.Publisher('lightsensors', LightSensorValues, queue_size=1)

	freq = get_freq()
	rate = rospy.Rate(freq)
	while not rospy.is_shutdown():
		try:
			with open(devfile,'r') as f:
				data = f.readline().split()
				data = [ int(e) for e in data ]
				d = LightSensorValues()
				d.right_forward = data[0]
				d.right_side = data[1]
				d.left_side = data[2]
				d.left_forward = data[3]
				d.sum_all = sum(data)
				d.sum_forward = data[0] + data[3]
				pub.publish(d)
		except IOError:
			rospy.logerr("cannot write to " + devfile)
		
		f = get_freq()
		if f != freq:
			freq = f
			rate = rospy.Rate(freq)		

	rate.sleep()

<commit_msg>mod: indent error<commit_after>#!/usr/bin/env python
#encoding: utf8

import sys, rospy
from pimouse_ros.msg import LightSensorValues

def get_freq():
	f = rospy.get_param('lightsensors_freq', 10)
	try:
		if f <= 0.0:
			raise Exception()
	except:
		rospy.logerr("value error: lightsensors_freq")
		sys.exit(1)
	return f

if __name__ == '__main__':
	devfile = "/dev/rtlightsensor0"
	rospy.init_node("lightsensors")
	pub = rospy.Publisher('lightsensors', LightSensorValues, queue_size=1)

	freq = get_freq()
	rate = rospy.Rate(freq)
	while not rospy.is_shutdown():
		try:
			with open(devfile,'r') as f:
				data = f.readline().split()
				data = [ int(e) for e in data ]
				d = LightSensorValues()
				d.right_forward = data[0]
				d.right_side = data[1]
				d.left_side = data[2]
				d.left_forward = data[3]
				d.sum_all = sum(data)
				d.sum_forward = data[0] + data[3]
				pub.publish(d)
		except IOError:
			rospy.logerr("cannot write to " + devfile)
		
		f = get_freq()
		if f != freq:
			freq = f
			rate = rospy.Rate(freq)		

		rate.sleep()


{'fraction_non_alphanumeric': 0.140543115769414, 'fraction_numerical': 0.01333968556455455, 'mean_word_length': 3.4680851063829787, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6476228', 'n_tokens_mistral': 953, 'n_tokens_neox': 836, 'n_words': 184}