<commit_before># coding=utf-8
from watchdog.observers import Observer
from watchdog.events import FileSystemEvent, FileSystemEventHandler

class FileSystemWatcher:
    def __init__(self, core) -> None:
        self.core = core

        self.observer: Observer = Observer()
        self.observer.schedule(ChangeHandler(self), self.core.config.directory.plugins)

    def start(self) -> None:
        self.observer.start()

class ChangeHandler(FileSystemEventHandler):
    def __init__(self, core) -> None:
        super().__init__()
        self.core = core

    def on_created(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.loadPlugin(path=event.src_path)

    def on_modified(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.loadPlugin(path=event.src_path)

    def on_deleted(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.unloadPlugin(path=event.src_path)
<commit_msg>Fix: cannot start FileSystemWatcher<commit_after># coding=utf-8
from watchdog.observers import Observer
from watchdog.events import FileSystemEvent, FileSystemEventHandler

class FileSystemWatcher:
    def __init__(self, core) -> None:
        self.core = core

        self.observer: Observer = Observer()
        self.observer.schedule(ChangeHandler(self.core), self.core.config.directory.plugins)

    def start(self) -> None:
        self.observer.start()

class ChangeHandler(FileSystemEventHandler):
    def __init__(self, core) -> None:
        super().__init__()
        self.core = core

    def on_created(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.loadPlugin(path=event.src_path)

    def on_modified(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.loadPlugin(path=event.src_path)

    def on_deleted(self, event: FileSystemEvent) -> None:
        if not event.src_path.endswith(".py"):
            return

        self.core.PM.unloadPlugin(path=event.src_path)

{'fraction_non_alphanumeric': 0.11224944320712694, 'fraction_numerical': 0.0008908685968819599, 'mean_word_length': 2.919720767888307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4580780', 'n_tokens_mistral': 686, 'n_tokens_neox': 665, 'n_words': 138}