import sys

from output_handle.colorizer import Colorizer

from multiprocessing import Queue

q = Queue()


class Output:

    def __init__(self):
        self.output_buffer = q

    def __call__(self, obj):
        self.write(obj)

    def write(self, obj):
        self.output_buffer.put(obj)


out_put = Output()


def color_pipeline(message):
    colorizer = Colorizer()
    colorizer.register("INFO", color="yellow")
    message = colorizer.run(message)
    return message


def run(message):
    pipelines = [globals()[name] for name in globals() if name.endswith('_pipeline')]
    for pipeline in pipelines:
        message = pipeline(message)
    out_put(message)


if __name__ == '__main__':
    info = "INFO: I am bot"
    run(info)

import sys

from output_handle.colorizer import Colorizer

from multiprocessing import Queue

q = Queue()


class Output:

    def __init__(self):
        self.output_buffer = q

    def __call__(self, obj):
        self.write(obj)

    def write(self, obj):
        self.output_buffer.put(obj)


out_put = Output()


def color_pipeline(message):
    colorizer = Colorizer()
    colorizer.register("INFO", color="yellow")
    message = colorizer.run(message)
    return message


def run(message):
    pipelines = [globals()[name] for name in globals() if name.endswith('_pipeline')]
    for pipeline in pipelines:
        message = pipeline(message)
    out_put(message)


if __name__ == '__main__':
    info = "INFO: I am bot"
    run(info)
