<commit_before>import subprocess
import rospy
import rosservice

class KmlAlive:
    def __init__(self, earth_proc):
        self.earth_proc = earth_proc
        rospy.sleep(5)
        self.keep_alive()

    def keep_alive(self):
        loop_timeout = 0.2
        with open('/dev/null', 'w') as dev_null:
            while not rospy.is_shutdown():
                try:
                    pid = self.earth_proc.proc.watcher.proc.pid
                except AttributeError:
                    rospy.sleep(loop_timeout)
                if '/kmlsync/state' in rosservice.get_service_list():
                    cmd = "lsof -Pn -p {} -a -i @127.0.0.1:8765".format(pid).split(' ')
                        ret_value = subprocess.call(
                            cmd,
                            stdout=dev_null,
                            stderr=dev_null,
                            close_fds=True
                        )<commit_msg>fixes<commit_after>import subprocess
import rospy
import rosservice

class KmlAlive:
    def __init__(self, earth_proc):
        self.earth_proc = earth_proc
        rospy.sleep(5)
        self.keep_alive()

    def keep_alive(self):
        loop_timeout = 0.2
        with open('/dev/null', 'w') as dev_null:
            while not rospy.is_shutdown():
                try:
                    pid = self.earth_proc.proc.watcher.proc.pid
                except AttributeError:
                    rospy.sleep(loop_timeout)
                    continue
                if '/kmlsync/state' in rosservice.get_service_list():
                    cmd = "lsof -Pn -p {} -a -i @127.0.0.1:8765".format(pid).split(' ')
                        ret_value = subprocess.call(
                            cmd,
                            stdout=dev_null,
                            stderr=dev_null,
                            close_fds=True
                        )
{'fraction_non_alphanumeric': 0.09114997350291468, 'fraction_numerical': 0.01377848436671966, 'mean_word_length': 1.2264150943396226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1764513', 'n_tokens_mistral': 570, 'n_tokens_neox': 531, 'n_words': 101}