FunctionController

A lightweight Python package to manage and control function execution easily.

The creator was the same developer of the VertexEngine Projects and the packages.

It's made to add more complex control over your functions.

Installation

pip install functioncontroller

Usage


from functioncontroller import *

@[DECORATOR]
def hello():
    print("Hello World")

hello()
            

API Reference

FunctionFlow

The standard package to import the flow operators

fallback

Adds a fallback function if the function fails. It can be used on unstable APIs

repeat

Repeats the Execution of a function.

exitFunctionIF

Exits the function if a specified condition is met.

skipToFunction

Skips to another function when a condition is met.

pause

waits x seconds before executing a function.

Examples

pause


from FunctionFlow import pause
@pause(1)
def hello():
    print("hello, world")
hello()
            

fallback


from FunctionFlow import fallback
def fallback_hello():
    print("fallback!")
@fallback(fallback_hello)
def hello():
    print("hello, world"
hello()
            

repeat


from FunctionFlow import repeat
@repeat(3)
def hello():
    print("hello, world")
hello()
            

exitFunctionIf


from FunctionFlow import exitFunctionIf
def returner():
    return 2 == 2
@exitFunctionIf(returner)
def hello():
    print("hello, world")
hello()
            

skipToFunction


from FunctionFlow import skipToFunction
def returner():
    return 2 == 2

def other():
    print("other function")

@skipToFunction(returner, "other")
def hello():
    print("hello, world")
hello()