clipspy-1.0.0/clips/classes.py
def make_instance(self, instance_name: str = None, **slots) -> Instance:
        """Make a new Instance from this Class.

        Equivalent to the CLIPS (make-instance) function.

        """
        builder = environment_builder(self._env, 'instance')
        ret = lib.IBSetDefclass(builder, lib.DefclassName(self._ptr()))
        if ret != lib.IBE_NO_ERROR:
            raise CLIPSError(self._env, code=ret)

        for slot, slot_val in slots.items():
            value = clips.values.clips_value(self._env, value=slot_val)

            ret = lib.IBPutSlot(builder, str(slot).encode(), value)
            if ret != PutSlotError.PSE_NO_ERROR:
                raise PUT_SLOT_ERROR[ret](slot)

        instance = lib.IBMake(
            builder, instance_name.encode()
            if instance_name is not None else ffi.NULL)
        if instance != ffi.NULL:
            return Instance(self._env, instance)
        else:
            raise CLIPSError(self._env, code=lib.FBError(self._env))
Make a new Instance from this Class.

        Equivalent to the CLIPS (make-instance) function.

        
Make a new Instance from this Class.
Equivalent to the CLIPS (make-instance) function.
Make a new Instance from this Class . Equivalent to the CLIPS ( make - instance ) function .
def make_instance(self, instance_name: str = None, **slots) -> Instance:
        builder = environment_builder(self._env, 'instance')
        ret = lib.IBSetDefclass(builder, lib.DefclassName(self._ptr()))
        if ret != lib.IBE_NO_ERROR:
            raise CLIPSError(self._env, code=ret)
        for slot, slot_val in slots.items():
            value = clips.values.clips_value(self._env, value=slot_val)
            ret = lib.IBPutSlot(builder, str(slot).encode(), value)
            if ret != PutSlotError.PSE_NO_ERROR:
                raise PUT_SLOT_ERROR[ret](slot)
        instance = lib.IBMake(
            builder, instance_name.encode()
            if instance_name is not None else ffi.NULL)
        if instance != ffi.NULL:
            return Instance(self._env, instance)
        else:
            raise CLIPSError(self._env, code=lib.FBError(self._env))
def make_instance ( self , instance_name : str = None , ** slots ) -> Instance : builder = environment_builder ( self . _env , 'instance' ) ret = lib . IBSetDefclass ( builder , lib . DefclassName ( self . _ptr ( ) ) ) if ret != lib . IBE_NO_ERROR : raise CLIPSError ( self . _env , code = ret ) for slot , slot_val in slots . items ( ) : value = clips . values . clips_value ( self . _env , value = slot_val ) ret = lib . IBPutSlot ( builder , str ( slot ) . encode ( ) , value ) if ret != PutSlotError . PSE_NO_ERROR : raise PUT_SLOT_ERROR [ ret ] ( slot ) instance = lib . IBMake ( builder , instance_name . encode ( ) if instance_name is not None else ffi . NULL ) if instance != ffi . NULL : return Instance ( self . _env , instance ) else : raise CLIPSError ( self . _env , code = lib . FBError ( self . _env ) )
Make a new Instance from this Class.
Make a new Instance from this Class .
"""Make a new Instance from this Class.

        Equivalent to the CLIPS (make-instance) function.

        """
self
instance_name
str