# Path: pynusmv/utils.py
# class writeonly:
#     """
#     writeonly provides a write only decorator for properties that do not
#     have a getter accessor. This makes for pythonic property-lik APIs where your
#     class defines should have defined a setter. Example::
# 
#         class Dummy(PointerWrapper):
#           # .. code elided ...
# 
#           @writeonly
#           def config_tweak(self, new_value_of_tweak):
#             lower_interface_set_tweak(self._ptr, new_value_of_tweak)
# 
#     Can be used the following way::
# 
#         d = Dummy()
#         # this is now perfectly OK
#         d.config_tweak = 42
# 
#         # this will however fail since no getter was defined
#         d.config_tweak
#     """
# 
#     def __init__(self, fn):
#         """Creates the decorator memeorizing the decorated func"""
#         self._fn     = fn
#         self.__doc__ = fn.__doc__ # be nice with the user documentation
# 
#     def __call__(self):
#         """
#         Executes the decoration (takes care itself to apply the decorated fn
#         """
#         return self
# 
#     def __set__(self, obj, value):
#         """
#         Executes the decorated setter function
#         """
#         self._fn(obj, value)
# 
#     def __get__(self, obj, _type):
#         """
#         Makes sure this property is only accessed in write only mode
#         """
#         msg = '{} is defined as a write only property'.format(self._fn.__name__)
#         raise AttributeError(msg)


from unittest      import TestCase
from pynusmv.utils import writeonly
'''
This module validates the behavior of the writeonly decorator used to create 
properties that do not have a getter
'''


       
class Dummy:
        """
        Dummy class (okay, it is not a good example) showing how to use the 
        writeonly decorator to provide a propertylike setter without the 
        burden of having a getter.
        """
        
        def __init__(self):
            """Creates a dummy object"""
            self._value = 0
            

# Path: pynusmv/utils.py
# class writeonly:
#     """
#     writeonly provides a write only decorator for properties that do not
#     have a getter accessor. This makes for pythonic property-lik APIs where your
#     class defines should have defined a setter. Example::
# 
#         class Dummy(PointerWrapper):
#           # .. code elided ...
# 
#           @writeonly
#           def config_tweak(self, new_value_of_tweak):
#             lower_interface_set_tweak(self._ptr, new_value_of_tweak)
# 
#     Can be used the following way::
# 
#         d = Dummy()
#         # this is now perfectly OK
#         d.config_tweak = 42
# 
#         # this will however fail since no getter was defined
#         d.config_tweak
#     """
# 
#     def __init__(self, fn):
#         """Creates the decorator memeorizing the decorated func"""
#         self._fn     = fn
#         self.__doc__ = fn.__doc__ # be nice with the user documentation
# 
#     def __call__(self):
#         """
#         Executes the decoration (takes care itself to apply the decorated fn
#         """
#         return self
# 
#     def __set__(self, obj, value):
#         """
#         Executes the decorated setter function
#         """
#         self._fn(obj, value)
# 
#     def __get__(self, obj, _type):
#         """
#         Makes sure this property is only accessed in write only mode
#         """
#         msg = '{} is defined as a write only property'.format(self._fn.__name__)
#         raise AttributeError(msg)


# Path: tests/pynusmv/testWriteOnly.py
from unittest      import TestCase
from pynusmv.utils import writeonly

'''
This module validates the behavior of the writeonly decorator used to create 
properties that do not have a getter
'''


       
class Dummy:
        """
        Dummy class (okay, it is not a good example) showing how to use the 
        writeonly decorator to provide a propertylike setter without the 
        burden of having a getter.
        """
        
        def __init__(self):
            """Creates a dummy object"""
            self._value = 0
            

        @writeonly