# Path: py3status/profiling.py
# def profile(thread_run_fn):
#     if not enable_profiling:
#         return thread_run_fn
# 
#     def wrapper_run(self):
#         """Wrap the Thread.run() method
#         """
#         profiler = cProfile.Profile()
#         try:
#             return profiler.runcall(thread_run_fn, self)
#         finally:
#             thread_id = getattr(self, "ident", "core")
#             profiler.dump_stats(f"py3status-{thread_id}.profile")
# 
#     return wrapper_run


import select
import sys
from threading import Thread
from subprocess import Popen, PIPE
from json import loads
from shlex import quote as shell_quote
from py3status.profiling import profile
        if self.config["debug"]:
            self.py3_wrapper.log(
                'trying to dispatch event to module "{}"'.format(
                    f"{name} {instance}".strip()
                )
            )

        # guess the module config name
        module_name = f"{name} {instance}".strip()

        default_event = False
        module_info = self.output_modules.get(module_name)
        module = module_info["module"]
        # execute any configured i3-msg command
        # we do not do this for containers
        # modules that have failed do not execute their config on_click
        if module.allow_config_clicks:
            button = event.get("button", 0)
            on_click = self.on_click.get(module_name, {}).get(str(button))
            if on_click:
                task = EventClickTask(module_name, event, self, on_click)
                self.py3_wrapper.timeout_queue_add(task)
            # otherwise setup default action on button 2 press
            elif button == 2:
                default_event = True

        # do the work
        task = EventTask(module_name, event, default_event, self)
        self.py3_wrapper.timeout_queue_add(task)


# Path: py3status/profiling.py
# def profile(thread_run_fn):
#     if not enable_profiling:
#         return thread_run_fn
# 
#     def wrapper_run(self):
#         """Wrap the Thread.run() method
#         """
#         profiler = cProfile.Profile()
#         try:
#             return profiler.runcall(thread_run_fn, self)
#         finally:
#             thread_id = getattr(self, "ident", "core")
#             profiler.dump_stats(f"py3status-{thread_id}.profile")
# 
#     return wrapper_run


# Path: py3status/events.py
import select
import sys
from threading import Thread
from subprocess import Popen, PIPE
from json import loads
from shlex import quote as shell_quote
from py3status.profiling import profile

        if self.config["debug"]:
            self.py3_wrapper.log(
                'trying to dispatch event to module "{}"'.format(
                    f"{name} {instance}".strip()
                )
            )

        # guess the module config name
        module_name = f"{name} {instance}".strip()

        default_event = False
        module_info = self.output_modules.get(module_name)
        module = module_info["module"]
        # execute any configured i3-msg command
        # we do not do this for containers
        # modules that have failed do not execute their config on_click
        if module.allow_config_clicks:
            button = event.get("button", 0)
            on_click = self.on_click.get(module_name, {}).get(str(button))
            if on_click:
                task = EventClickTask(module_name, event, self, on_click)
                self.py3_wrapper.timeout_queue_add(task)
            # otherwise setup default action on button 2 press
            elif button == 2:
                default_event = True

        # do the work
        task = EventTask(module_name, event, default_event, self)
        self.py3_wrapper.timeout_queue_add(task)


    @profile