Skip to content

A simple pythonic single threaded IOC (inversion of control) library

License

Notifications You must be signed in to change notification settings

finete/EventBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventBus

A simple pythonic single threaded IOC (inversion of control) library

Usage example

csv_data.py

# an example of an accessor class
class CsvAccessor:
    def __init__(self, path: str):
        self.path = path
    
    def read_data(self, arg1: int, arg2: int):
        ...

main.py

from eventbus import EventBus

# initializing the evenBus (IOC)
if __name__ == '__main__':
    # the keys are the names of the interface  
    # the values are the import path of the classes 
    eb = EventBus({'data_interface': 'csv_data.CsvAccessor'})

    # invoking the method
    eb.on_event(interface='data_interface', method='read_data', kwargs={
        'arg1':1, 'arg2':2
    })
    
    # can also invoke via the class directly
    eb(interface='data_interface', method='read_data', kwargs={
        'arg1':1, 'arg2':2
    })

TODO

  • add support for interfaces
  • add support for secret extraction

About

A simple pythonic single threaded IOC (inversion of control) library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages