How to use the decorator.starbuzz.CondimentDecorator function in decorator

To help you get started, we’ve selected a few decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github miguelalba-old / hfdp-python / decorator / starbuzz.py View on Github external
return .20 + self._beverage.cost()


class Soy(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Soy"

    def cost(self):
        return .15 + self._beverage.cost()


class Whip(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Whip"

    def cost(self):
        return .10 + self._beverage.cost()


###############################################################################
# Simulation
###############################################################################

if __name__ == '__main__':
github miguelalba-old / hfdp-python / decorator / starbuzz.py View on Github external
pass


class Milk(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Milk"

    def cost(self):
        return .10 + self._beverage.cost()


class Mocha(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Mocha"

    def cost(self):
        return .20 + self._beverage.cost()


class Soy(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage
github miguelalba-old / hfdp-python / decorator / starbuzz.py View on Github external
return 1.05


###############################################################################
# Condiment decorators
###############################################################################

class CondimentDecorator(Beverage):
    __metaclass__ = ABCMeta

    @abstractmethod
    def get_description(self):
        pass


class Milk(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Milk"

    def cost(self):
        return .10 + self._beverage.cost()


class Mocha(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage
github miguelalba-old / hfdp-python / decorator / starbuzz.py View on Github external
return .10 + self._beverage.cost()


class Mocha(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Mocha"

    def cost(self):
        return .20 + self._beverage.cost()


class Soy(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage

    def get_description(self):
        return self._beverage.get_description() + ", Soy"

    def cost(self):
        return .15 + self._beverage.cost()


class Whip(CondimentDecorator):

    def __init__(self, beverage):
        self._beverage = beverage