A simple implement for discrete events simulation.
Project description
Akatosh
This is a light weighted disceret event simulation library. The name is from the Dragon God of Time in Elder Scroll. :)
Install
pip install --upgrade Akatosh
How to use
Import modules:
from Akatosh import Mundus, Actor
create actors, aka event:
There are serveral ways that you can create an event:
-
Create an event with lambda expression
Actor(action = lambda: print("All hail dragonborn!"))
-
Create an event with defined functions:
#funtion without arguments def hail(): print("All hail dragonborn!") Actor(action = hail) #function with arguments def hail(message: str): print(message) Actor(action = hail, message = "All hail dragonborn!")
-
Create an event by subclass:
class Myevent(Actor): def action(self): print("All hail dragonborn!") Myevent()
-
Create with decorator (new!)
#directly create an event with a function: @event() def hail(): print(f"{Mundus.now}:\tHail Akatosh!") #create a on call event, that is the decorated function must be called to actually make the event @event(on_call=True) def dragon_shout(msg:str="Ros Fu Da!"): print(f"{Mundus.now}:\t{msg}")
To start the simulation,
Mundus.simulate(till=inf)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Akatosh-1.6.6.tar.gz
(9.8 kB
view hashes)
Built Distribution
Akatosh-1.6.6-py3-none-any.whl
(11.9 kB
view hashes)