thoaded

Thoaded

Library for simple and fast design pattern that extends model, view and controller for asynchronous events in supported modern programming languages.

Installation

Use pip to install these utilities:

pip install thoaded

Documentation

Thoaded applications are created by composing a series of simple inheritances. By convention, this components extends Modify-based Asynchronous Pattern.

from thoaded import Modeled, Viewed, Controlled
import asyncio

class SampleMoldeled(Modeled):

    async def added(self, value):
        return value

    async def updated(self, value):
        return value

    async def deleted(self, value):
        return value

    async def readed(self, value):
        return value

    async def queried(self, value=None):
        return value

    async def listened(self, value=None):
        return value

    async def unlistened(self, value=None):
        return value

class SampleViewed(Viewed):

    async def added(self, value):
        return value

    async def updated(self, value):
        return value

    async def deleted(self, value):
        return value

    async def readed(self, value):
        return value

    async def queried(self, value=None):
        return value

    async def listened(self, value=None):
        return value

    async def unlistened(self, value=None):
        return value

class SampleControlled(Controlled):

    def __init__(self):
        super().__init__(SampleMoldeled(), SampleViewed())
        text = asyncio.run(self.modeled.readed("Hello, World!"))
        text = asyncio.run(self.viewed.readed(text))
        print("Print " + text + " successfully.")

Compatibility

Thoaded supports all environments that are Python 3.