<commit_before>import logging
import os
import subprocess
import time
import typing as t
from configparser import ConfigParser, NoOptionError
from pathlib import Path
from pprint import pformat

import itertools
from inotify import constants as ic
from inotify.adapters import Inotify

log = logging.getLogger(__name__)


class I3Configger:
    """Watch a directory tree and build/refresh/notify on changes"""
    MASK = (
        ic.IN_CREATE | ic.IN_ATTRIB | ic.IN_DELETE |
        ic.IN_MODIFY | ic.IN_CLOSE_WRITE |
        ic.IN_MOVED_FROM | ic.IN_MOVED_TO |
        ic.IN_DELETE_SELF | ic.IN_MOVE_SELF)
    """Tell inotify to trigger on changes"""

    def __init__(self, buildDefs, maxerrors=10):
        self.buildDefs: [BuildDef] = buildDefs
        self.allWatchPaths = itertools.chain.from_iterable(
            [bd.watchPaths for bd in self.buildDefs])
        self.maxerrors = maxerrors
        self.inotify_watcher = Inotify()
        self.lastBuild = None
        self.lastFilename = None
        self.errors = 0

    def build(self):
        for buildDef in self.buildDefs:
            buildDef.build()

    def watch(self):
        for event in self.get_events():
            self.process_event(event)<commit_msg>I sea dead code and stale docs<commit_after>import logging
import os
import subprocess
import time
import typing as t
from configparser import ConfigParser, NoOptionError
from pathlib import Path
from pprint import pformat

import itertools
from inotify import constants as ic
from inotify.adapters import Inotify

log = logging.getLogger(__name__)


class I3Configger:
    """Watch a config directories and build/refresh/notify on changes"""
    MASK = (
        ic.IN_CREATE | ic.IN_ATTRIB | ic.IN_DELETE |
        ic.IN_MODIFY | ic.IN_CLOSE_WRITE |
        ic.IN_MOVED_FROM | ic.IN_MOVED_TO |
        ic.IN_DELETE_SELF | ic.IN_MOVE_SELF)
    """Tell inotify to trigger on changes"""

    def __init__(self, buildDefs, maxerrors=10):
        self.buildDefs: [BuildDef] = buildDefs
        self.allWatchPaths = itertools.chain.from_iterable(
            [bd.watchPaths for bd in self.buildDefs])
        self.maxerrors = maxerrors
        self.inotify_watcher = Inotify()
        self.errors = 0

    def build(self):
        for buildDef in self.buildDefs:
            buildDef.build()

    def watch(self):
        for event in self.get_events():
            self.process_event(event)
{'fraction_non_alphanumeric': 0.07698675496688742, 'fraction_numerical': 0.0033112582781456954, 'mean_word_length': 2.892109500805153, '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': '611889', 'n_tokens_mistral': 758, 'n_tokens_neox': 745, 'n_words': 207}