# Path: axiom/slotmachine.py
# class SetOnce(Attribute):
# 
#     def __init__(self, doc='', default=_RAISE):
#         Attribute.__init__(self)
#         if default is _RAISE:
#             self.default = ()
#         else:
#             self.default = (default,)
# 
#     def requiredSlots(self, modname, classname, attrname):
#         self.name = attrname
#         t = self.trueattr = ('_' + self.name)
#         yield t
# 
#     def __set__(self, iself, value):
#         if not hasattr(iself, self.trueattr):
#             setattr(iself, self.trueattr, value)
#         else:
#             raise AttributeError('{}.{} may only be set once'.format(
#                     type(iself).__name__, self.name))
# 
#     def __get__(self, iself, type=None):
#         if type is not None and iself is None:
#             return self
#         return getattr(iself, self.trueattr, *self.default)
# 
# class Attribute(object):
#     def __init__(self, doc=''):
#         self.doc = doc
# 
#     def requiredSlots(self, modname, classname, attrname):
#         self.name = attrname
#         yield attrname
# 
#     def __get__(self, oself, type=None):
#         assert oself is None, "{}: should be masked".format(self.name)
#         return self
# 
# class SlotMachine(six.with_metaclass(_SlotMetaMachine, _Strict)):
#     pass
# 
# class SchemaMachine(six.with_metaclass(SchemaMetaMachine, _Strict)):
#     pass


from twisted.trial import unittest
from axiom.slotmachine import SetOnce, Attribute, SlotMachine, SchemaMachine


class A(SlotMachine):
    slots = ['a', 'initialized']

class B(SchemaMachine):
    test = Attribute()

# Path: axiom/slotmachine.py
# class SetOnce(Attribute):
# 
#     def __init__(self, doc='', default=_RAISE):
#         Attribute.__init__(self)
#         if default is _RAISE:
#             self.default = ()
#         else:
#             self.default = (default,)
# 
#     def requiredSlots(self, modname, classname, attrname):
#         self.name = attrname
#         t = self.trueattr = ('_' + self.name)
#         yield t
# 
#     def __set__(self, iself, value):
#         if not hasattr(iself, self.trueattr):
#             setattr(iself, self.trueattr, value)
#         else:
#             raise AttributeError('{}.{} may only be set once'.format(
#                     type(iself).__name__, self.name))
# 
#     def __get__(self, iself, type=None):
#         if type is not None and iself is None:
#             return self
#         return getattr(iself, self.trueattr, *self.default)
# 
# class Attribute(object):
#     def __init__(self, doc=''):
#         self.doc = doc
# 
#     def requiredSlots(self, modname, classname, attrname):
#         self.name = attrname
#         yield attrname
# 
#     def __get__(self, oself, type=None):
#         assert oself is None, "{}: should be masked".format(self.name)
#         return self
# 
# class SlotMachine(six.with_metaclass(_SlotMetaMachine, _Strict)):
#     pass
# 
# class SchemaMachine(six.with_metaclass(SchemaMetaMachine, _Strict)):
#     pass


# Path: axiom/test/test_slotmachine.py
from twisted.trial import unittest
from axiom.slotmachine import SetOnce, Attribute, SlotMachine, SchemaMachine



class A(SlotMachine):
    slots = ['a', 'initialized']

class B(SchemaMachine):
    test = Attribute()

    initialized = SetOnce()