<commit_before>"""Watch files and send a SIGHUP signal to another process
if any of the files change.
"""


import optparse, os, sets, signal, sys, tempfile, time

from eventlet import api, coros, jsonhttp

import simplejson


def watch_forever(urls, pid, interval):
    """
    """
    limiter = coros.CoroutinePool(track_events=True)
    module_mtimes = {}
    last_changed_time = None
    while True:
        uniques = sets.Set()

        if urls:
            for url in urls:
                limiter.execute(jsonhttp.get, url)
    
            for i in range(len(urls)):
                uniques.update(limiter.wait()['files'])
        else:
            uniques.update(list(get_sys_modules_files()))


        changed = False
        for filename in uniques:
            try:
                stat = os.stat(filename)
                if stat:
                    mtime = stat.st_mtime<commit_msg>Make reloader_dev.py watch easy-install.pth as well as all the python modules in sys.modules for changes<commit_after>"""Watch files and send a SIGHUP signal to another process
if any of the files change.
"""


import optparse, os, sets, signal, sys, tempfile, time
from os.path import join
from distutils import sysconfig

from eventlet import api, coros, jsonhttp

import simplejson


def watch_forever(urls, pid, interval):
    """
    """
    limiter = coros.CoroutinePool(track_events=True)
    module_mtimes = {}
    last_changed_time = None
    while True:
        uniques = sets.Set()

        if urls:
            for url in urls:
                limiter.execute(jsonhttp.get, url)
    
            for i in range(len(urls)):
                uniques.update(limiter.wait()['files'])
        else:
            uniques.add(join(sysconfig.get_python_lib(), 'easy-install.pth'))
            uniques.update(list(get_sys_modules_files()))

        changed = False
        for filename in uniques:
            try:
                stat = os.stat(filename)
                if stat:
                    mtime = stat.st_mtime
{'fraction_non_alphanumeric': 0.09104403760514597, 'fraction_numerical': 0.0, 'mean_word_length': 2.1059907834101383, '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': '5797960', 'n_tokens_mistral': 599, 'n_tokens_neox': 584, 'n_words': 169}