<commit_before>#!/usr/bin/env python

import rospy
from interactivespaces_msgs.msg import GenericMessage
from lg_replay import DevicePublisher, DeviceReplay, LgActivityException


def main():
    rospy.init_node('lg_replay', anonymous=True)

    topic_name = rospy.get_param('~topic_name', None)
    device_name = rospy.get_param('~device_name', None)
    event_ecode = rospy.get_param('~event_ecode', 'EV_KEY')
    device_path = rospy.get_param('~device_path', None)

    if not topic_name or not (device_name or device_path):
        msg = "You must provide lg_activity topic name and (device name or device path)"
        rospy.logerr(msg)
        raise ROSNodeIOException(msg)

    publisher = rospy.Publisher(topic_name, GenericMessage, queue_size=10)

    device_publisher = DevicePublisher(publisher)

    if device_path:
        dev = InputDevice(device_path)
        if not device_name:
            device_name = dev.name
        device_replay = DeviceReplay(device_publisher, device_name, event_ecode, device=device)
    else:
        device_replay = DeviceReplay(device_publisher, device_name, event_ecode)

    device_replay.run()
    rospy.spin()

if __name__ == '__main__':
    main()<commit_msg>lg_replay: add import and name input device device<commit_after>#!/usr/bin/env python

import rospy
from interactivespaces_msgs.msg import GenericMessage
from lg_replay import DevicePublisher, DeviceReplay, LgActivityException
from evdev import InputDevice


def main():
    rospy.init_node('lg_replay', anonymous=True)

    topic_name = rospy.get_param('~topic_name', None)
    device_name = rospy.get_param('~device_name', None)
    event_ecode = rospy.get_param('~event_ecode', 'EV_KEY')
    device_path = rospy.get_param('~device_path', None)

    if not topic_name or not (device_name or device_path):
        msg = "You must provide lg_activity topic name and (device name or device path)"
        rospy.logerr(msg)
        raise ROSNodeIOException(msg)

    publisher = rospy.Publisher(topic_name, GenericMessage, queue_size=10)

    device_publisher = DevicePublisher(publisher)

    if device_path:
        device = InputDevice(device_path)
        if not device_name:
            device_name = device.name
        device_replay = DeviceReplay(device_publisher, device_name, event_ecode, device=device)
    else:
        device_replay = DeviceReplay(device_publisher, device_name, event_ecode)

    device_replay.run()
    rospy.spin()

if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.08945046129161653, 'fraction_numerical': 0.001604492579221821, 'mean_word_length': 4.069105691056911, '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': '1047129', 'n_tokens_mistral': 829, 'n_tokens_neox': 798, 'n_words': 180}