#!/usr/bin/env yacl

from yacl import *


class Pair(YaclBaseClass):
    _execute = json_serializer()

    a = defaulting(5)

    def b():
        return get('b') or get('a') + 1000


class NegatingAMixin(GenericMixin, YaclBaseClass):
    a = lambda: -get()


class MyPair(NegatingAMixin, Pair):
    def a():
        if get('foo', False):
             return get() * 1000
        else:
             return get() / 1000

go(MyPair, context_set=[{"foo": True}, {"foo": False}])
