# Copyright 2019 Semaphore Solutions, Inc.
# ---------------------------------------------------------------------------


class lazy_property(object):
    """
    meant to be used for lazy evaluation of an object attribute.
    property should represent non-mutable data, as it replaces itself.
    """

    def __init__(self, fget):
        self.fget = fget
        self.__doc__ = fget.__doc__
        self.__name__ = fget.__name__
        self.__module__ = fget.__module__

    def __get__(self, obj, cls):
        if obj is None:
            return self
        value = self.fget(obj)
        setattr(obj, self.__name__, value)
        return value

# Copyright 2019 Semaphore Solutions, Inc.
# ---------------------------------------------------------------------------


class lazy_property(object):
    """
    meant to be used for lazy evaluation of an object attribute.
    property should represent non-mutable data, as it replaces itself.
    """

    def __init__(self, fget):
        self.fget = fget
        self.__doc__ = fget.__doc__
        self.__name__ = fget.__name__
        self.__module__ = fget.__module__

    def __get__(self, obj, cls):
        if obj is None:
            return self
        value = self.fget(obj)
        setattr(obj, self.__name__, value)
        return value

# Copyright 2019 Semaphore Solutions, Inc. # --------------------------------------------------------------------------- meant to be used for lazy evaluation of an object attribute.     property should represent non-mutable data, as it replaces itself.