from kpis import KPIs
from currentkpis import CurrentKPIs
from forecastkpis import ForecastKPIs

# report on the current KPI values
kpis = KPIs()
currentKPIs = CurrentKPIs(kpis)
forecastKPIs = ForecastKPIs(kpis)

kpis.set_kpis(25, 10, 5)
kpis.set_kpis(100, 50, 30)
kpis.set_kpis(50, 10, 20)

print('\n*** detaching the currentKPIs observer')
kpis.detach(currentKPIs)
kpis.set_kpis(150, 110, 120)
from kpis import KPIs
from currentkpis import CurrentKPIs
from forecastkpis import ForecastKPIs

# Report on current KPI values
kpis = KPIs()
with CurrentKPIs(kpis), ForecastKPIs(kpis):
    kpis.set_kpis(25, 10, 5)
    kpis.set_kpis(100, 50, 30)
    kpis.set_kpis(50, 10, 20)

print("*****No longer in context manager.\n\n")
kpis.set_kpis(150, 110, 120)
예제 #3
0
from kpis import KPIs
from currentkpis import CurrentKPIs
from forecastkpis import ForecastKPIs

# Report on current KPI values
with KPIs() as kpis:  # * Subject
    with CurrentKPIs(kpis), ForecastKPIs(kpis):  # * Observers
        kpis.set_kpis(25, 10, 5)
        kpis.set_kpis(100, 50, 30)
        kpis.set_kpis(50, 10, 20)

print('\n***Exited context managers.***\n\n')
kpis.set_kpis(150, 110, 120)
예제 #4
0
from kpis import KPIs
from currentkpis import CurrentKPIs
from forecastkpis import ForecastKPIs

# Report on current KPI values
kpis = KPIs()  # * Subject
current_kpis = CurrentKPIs(kpis)  # * Observer1
forecast_kpis = ForecastKPIs(kpis)  # * Observer2
kpis.set_kpis(25, 10, 5)
kpis.set_kpis(100, 50, 30)
kpis.set_kpis(50, 10, 20)

print('\n***Detaching the currentKPIs observer.***\n\n')
kpis.detach(current_kpis)
kpis.set_kpis(150, 110, 120)