code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
if lib.EnvRetract(self._env, self._fact) != 1:
raise CLIPSError(self._env) | def retract(self) | Retract the fact from the CLIPS environment. | 18.637154 | 8.51592 | 2.188507 |
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.append(value) | def append(self, value) | Append an element to the fact. | 17.066637 | 10.442924 | 1.634278 |
if self.asserted:
raise RuntimeError("Fact already asserted")
self._multifield.extend(values) | def extend(self, values) | Append multiple elements to the fact. | 16.332659 | 10.420117 | 1.567416 |
data = clips.data.DataObject(self._env)
data.value = list(self._multifield)
if lib.EnvPutFactSlot(
self._env, self._fact, ffi.NULL, data.byref) != 1:
raise CLIPSError(self._env)
super(ImpliedFact, self).assertit() | def assertit(self) | Assert the fact within CLIPS. | 16.520546 | 12.373332 | 1.335174 |
if sequence is not None:
if isinstance(sequence, dict):
for slot in sequence:
self[slot] = sequence[slot]
else:
for slot, value in sequence:
self[slot] = value
if mapping:
for slot in sequence:
self[slot] = sequence[slot] | def update(self, sequence=None, **mapping) | Add multiple elements to the fact. | 2.655167 | 2.320639 | 1.144153 |
return ffi.string(
lib.EnvGetDeftemplateName(self._env, self._tpl)).decode() | def name(self) | Template name. | 25.632345 | 16.824142 | 1.523545 |
modname = ffi.string(lib.EnvDeftemplateModule(self._env, self._tpl))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self._env, defmodule) | def module(self) | The module in which the Template is defined.
Python equivalent of the CLIPS deftemplate-module command. | 10.023197 | 6.880791 | 1.456693 |
lib.EnvSetDeftemplateWatch(self._env, int(flag), self._tpl) | def watch(self, flag) | Whether or not the Template is being watched. | 45.449249 | 29.310461 | 1.550615 |
if self.implied:
return ()
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotNames(self._env, self._tpl, data.byref)
return tuple(
TemplateSlot(self._env, self._tpl, n.encode()) for n in data.value) | def slots(self) | Iterate over the Slots of the Template. | 14.983373 | 12.072706 | 1.241095 |
fact = lib.EnvCreateFact(self._env, self._tpl)
if fact == ffi.NULL:
raise CLIPSError(self._env)
return new_fact(self._env, fact) | def new_fact(self) | Create a new Fact from this template. | 7.484213 | 5.918977 | 1.264444 |
if lib.EnvUndeftemplate(self._env, self._tpl) != 1:
raise CLIPSError(self._env) | def undefine(self) | Undefine the Template.
Python equivalent of the CLIPS undeftemplate command.
The object becomes unusable after this method has been called. | 27.882757 | 18.172678 | 1.534323 |
return bool(lib.EnvDeftemplateSlotMultiP(
self._env, self._tpl, self._name)) | def multifield(self) | True if the slot is a multifield slot. | 65.288651 | 39.641613 | 1.646973 |
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotTypes(
self._env, self._tpl, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def types(self) | A tuple containing the value types for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-types function. | 19.684629 | 10.144827 | 1.940361 |
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotRange(
self._env, self._tpl, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def range(self) | A tuple containing the numeric range for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-range function. | 19.430447 | 10.110445 | 1.921819 |
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotCardinality(
self._env, self._tpl, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def cardinality(self) | A tuple containing the cardinality for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-cardinality function. | 17.369017 | 10.208567 | 1.701416 |
return TemplateSlotDefaultType(
lib.EnvDeftemplateSlotDefaultP(self._env, self._tpl, self._name)) | def default_type(self) | The default value type for this Slot.
The Python equivalent of the CLIPS deftemplate-slot-defaultp function. | 51.582546 | 20.215231 | 2.551667 |
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotDefaultValue(
self._env, self._tpl, self._name, data.byref)
return data.value | def default_value(self) | The default value for this Slot.
The Python equivalent
of the CLIPS deftemplate-slot-default-value function. | 25.108633 | 13.400325 | 1.873733 |
data = clips.data.DataObject(self._env)
lib.EnvDeftemplateSlotAllowedValues(
self._env, self._tpl, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def allowed_values(self) | A tuple containing the allowed values for this Slot.
The Python equivalent of the CLIPS slot-allowed-values function. | 17.402098 | 12.546059 | 1.387057 |
value = bool(lib.EnvGetInstancesChanged(self._env))
lib.EnvSetInstancesChanged(self._env, int(False))
return value | def instances_changed(self) | True if any instance has changed. | 9.760356 | 7.178228 | 1.359717 |
defclass = lib.EnvGetNextDefclass(self._env, ffi.NULL)
while defclass != ffi.NULL:
yield Class(self._env, defclass)
defclass = lib.EnvGetNextDefclass(self._env, defclass) | def classes(self) | Iterate over the defined Classes. | 5.623276 | 4.552775 | 1.235132 |
defclass = lib.EnvFindDefclass(self._env, name.encode())
if defclass == ffi.NULL:
raise LookupError("Class '%s' not found" % name)
return Class(self._env, defclass) | def find_class(self, name) | Find the Class by its name. | 4.870172 | 4.363456 | 1.116127 |
definstance = lib.EnvGetNextInstance(self._env, ffi.NULL)
while definstance != ffi.NULL:
yield Instance(self._env, definstance)
definstance = lib.EnvGetNextInstance(self._env, definstance) | def instances(self) | Iterate over the defined Instancees. | 5.241603 | 4.262019 | 1.22984 |
module = module if module is not None else ffi.NULL
definstance = lib.EnvFindInstance(self._env, module, name.encode(), 1)
if definstance == ffi.NULL:
raise LookupError("Instance '%s' not found" % name)
return Instance(self._env, definstance) | def find_instance(self, name, module=None) | Find the Instance by its name. | 4.751011 | 4.260076 | 1.115241 |
instances = instances.encode()
if os.path.exists(instances):
try:
return self._load_instances_binary(instances)
except CLIPSError:
return self._load_instances_text(instances)
else:
return self._load_instances_string(instances) | def load_instances(self, instances) | Load a set of instances into the CLIPS data base.
The C equivalent of the CLIPS load-instances command.
Instances can be loaded from a string,
from a file or from a binary file. | 4.401055 | 2.960991 | 1.486345 |
instances = instances.encode()
if os.path.exists(instances):
ret = lib.EnvRestoreInstances(self._env, instances)
if ret == -1:
raise CLIPSError(self._env)
else:
ret = lib.EnvRestoreInstancesFromString(self._env, instances, -1)
if ret == -1:
raise CLIPSError(self._env)
return ret | def restore_instances(self, instances) | Restore a set of instances into the CLIPS data base.
The Python equivalent of the CLIPS restore-instances command.
Instances can be passed as a set of strings or as a file. | 3.963448 | 3.410639 | 1.162084 |
if binary:
ret = lib.EnvBinarySaveInstances(self._env, path.encode(), mode)
else:
ret = lib.EnvSaveInstances(self._env, path.encode(), mode)
if ret == 0:
raise CLIPSError(self._env)
return ret | def save_instances(self, path, binary=False, mode=SaveMode.LOCAL_SAVE) | Save the instances in the system to the specified file.
If binary is True, the instances will be saved in binary format.
The Python equivalent of the CLIPS save-instances command. | 4.018846 | 3.704641 | 1.084814 |
ist = lib.EnvMakeInstance(self._env, command.encode())
if ist == ffi.NULL:
raise CLIPSError(self._env)
return Instance(self._env, ist) | def make_instance(self, command) | Create and initialize an instance of a user-defined class.
command must be a string in the form:
(<instance-name> of <class-name> <slot-override>*)
<slot-override> :== (<slot-name> <constant>*)
Python equivalent of the CLIPS make-instance command. | 7.966562 | 8.573005 | 0.929261 |
return ffi.string(lib.EnvGetDefclassName(self._env, self._cls)).decode() | def name(self) | Class name. | 26.87879 | 16.169485 | 1.662316 |
modname = ffi.string(lib.EnvDefclassModule(self._env, self._cls))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self._env, defmodule) | def module(self) | The module in which the Class is defined.
Python equivalent of the CLIPS defglobal-module command. | 9.597707 | 7.100512 | 1.351692 |
lib.EnvSetDefclassWatchInstances(self._env, int(flag), self._cls) | def watch_instances(self, flag) | Whether or not the Class Instances are being watched. | 35.669579 | 26.698532 | 1.336013 |
lib.EnvSetDefclassWatchSlots(self._env, int(flag), self._cls) | def watch_slots(self, flag) | Whether or not the Class Slots are being watched. | 35.140057 | 27.163532 | 1.293648 |
ist = lib.EnvCreateRawInstance(self._env, self._cls, name.encode())
if ist == ffi.NULL:
raise CLIPSError(self._env)
return Instance(self._env, ist) | def new_instance(self, name) | Create a new raw instance from this Class.
No slot overrides or class default initializations
are performed for the instance.
This function bypasses message-passing. | 7.859292 | 7.392224 | 1.063184 |
ret = lib.EnvFindDefmessageHandler(
self._env, self._cls, handler_name.encode(), handler_type.encode())
if ret == 0:
raise CLIPSError(self._env)
return MessageHandler(self._env, self._cls, ret) | def find_message_handler(self, handler_name, handler_type='primary') | Returns the MessageHandler given its name and type for this class. | 6.151983 | 5.568673 | 1.104749 |
return bool(lib.EnvSubclassP(self._env, self._cls, klass._cls)) | def subclass(self, klass) | True if the Class is a subclass of the given one. | 22.418974 | 19.96566 | 1.122877 |
return bool(lib.EnvSuperclassP(self._env, self._cls, klass._cls)) | def superclass(self, klass) | True if the Class is a superclass of the given one. | 19.087605 | 17.773502 | 1.073936 |
data = clips.data.DataObject(self._env)
lib.EnvClassSlots(self._env, self._cls, data.byref, int(inherited))
return (ClassSlot(self._env, self._cls, n.encode()) for n in data.value) | def slots(self, inherited=False) | Iterate over the Slots of the class. | 14.313265 | 11.523374 | 1.242107 |
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ffi.NULL)
while ist != ffi.NULL:
yield Instance(self._env, ist)
ist = lib.EnvGetNextInstanceInClass(self._env, self._cls, ist) | def instances(self) | Iterate over the instances of the class. | 4.59264 | 4.01731 | 1.143213 |
data = clips.data.DataObject(self._env)
lib.EnvClassSubclasses(self._env, self._cls, data.byref, int(inherited))
for klass in classes(self._env, data.value):
yield klass | def subclasses(self, inherited=False) | Iterate over the subclasses of the class.
This function is the Python equivalent
of the CLIPS class-subclasses command. | 13.601109 | 11.415138 | 1.191497 |
data = clips.data.DataObject(self._env)
lib.EnvClassSuperclasses(
self._env, self._cls, data.byref, int(inherited))
for klass in classes(self._env, data.value):
yield klass | def superclasses(self, inherited=False) | Iterate over the superclasses of the class.
This function is the Python equivalent
of the CLIPS class-superclasses command. | 14.117291 | 11.36254 | 1.242441 |
index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, 0)
while index != 0:
yield MessageHandler(self._env, self._cls, index)
index = lib.EnvGetNextDefmessageHandler(self._env, self._cls, index) | def message_handlers(self) | Iterate over the message handlers of the class. | 5.330391 | 4.355179 | 1.22392 |
if lib.EnvUndefclass(self._env, self._cls) != 1:
raise CLIPSError(self._env)
self._env = None | def undefine(self) | Undefine the Class.
Python equivalent of the CLIPS undefclass command.
The object becomes unusable after this method has been called. | 18.000143 | 12.069441 | 1.491382 |
return bool(lib.EnvSlotPublicP(self._env, self._cls, self._name)) | def public(self) | True if the Slot is public. | 31.382523 | 19.230259 | 1.631934 |
return bool(lib.EnvSlotInitableP(self._env, self._cls, self._name)) | def initializable(self) | True if the Slot is initializable. | 34.628326 | 17.69293 | 1.957184 |
return bool(lib.EnvSlotWritableP(self._env, self._cls, self._name)) | def writable(self) | True if the Slot is writable. | 31.939037 | 20.488585 | 1.55887 |
return bool(lib.EnvSlotDirectAccessP(self._env, self._cls, self._name)) | def accessible(self) | True if the Slot is directly accessible. | 34.558475 | 19.813858 | 1.744157 |
data = clips.data.DataObject(self._env)
lib.EnvSlotTypes(self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def types(self) | A tuple containing the value types for this Slot.
The Python equivalent of the CLIPS slot-types function. | 15.599627 | 10.603161 | 1.471224 |
data = clips.data.DataObject(self._env)
lib.EnvSlotSources(self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def sources(self) | A tuple containing the names of the Class sources for this Slot.
The Python equivalent of the CLIPS slot-sources function. | 16.64126 | 10.673317 | 1.559146 |
data = clips.data.DataObject(self._env)
lib.EnvSlotRange(self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def range(self) | A tuple containing the numeric range for this Slot.
The Python equivalent of the CLIPS slot-range function. | 14.985991 | 10.897211 | 1.375213 |
data = clips.data.DataObject(self._env)
lib.EnvSlotFacets(self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def facets(self) | A tuple containing the facets for this Slot.
The Python equivalent of the CLIPS slot-facets function. | 14.936111 | 9.809293 | 1.522649 |
data = clips.data.DataObject(self._env)
lib.EnvSlotCardinality(
self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def cardinality(self) | A tuple containing the cardinality for this Slot.
The Python equivalent of the CLIPS slot-cardinality function. | 14.305467 | 9.782207 | 1.462397 |
data = clips.data.DataObject(self._env)
lib.EnvSlotDefaultValue(
self._env, self._cls, self._name, data.byref)
return data.value | def default_value(self) | The default value for this Slot.
The Python equivalent of the CLIPS slot-default-value function. | 19.310699 | 13.369176 | 1.44442 |
data = clips.data.DataObject(self._env)
lib.EnvSlotAllowedValues(
self._env, self._cls, self._name, data.byref)
return tuple(data.value) if isinstance(data.value, list) else () | def allowed_values(self) | A tuple containing the allowed values for this Slot.
The Python equivalent of the CLIPS slot-allowed-values function. | 13.982626 | 9.778382 | 1.429953 |
data = clips.data.DataObject(self._env)
lib.EnvSlotAllowedClasses(
self._env, self._cls, self._name, data.byref)
if isinstance(data.value, list):
for klass in classes(self._env, data.value):
yield klass | def allowed_classes(self) | Iterate over the allowed classes for this slot.
The Python equivalent of the CLIPS slot-allowed-classes function. | 14.095773 | 9.847829 | 1.431358 |
return ffi.string(lib.EnvGetInstanceName(self._env, self._ist)).decode() | def name(self) | Instance name. | 27.837454 | 18.721622 | 1.486915 |
return Class(self._env, lib.EnvGetInstanceClass(self._env, self._ist)) | def instance_class(self) | Instance class. | 28.046417 | 21.061049 | 1.331672 |
output = clips.data.DataObject(self._env)
instance = clips.data.DataObject(
self._env, dtype=CLIPSType.INSTANCE_ADDRESS)
instance.value = self._ist
args = arguments.encode() if arguments is not None else ffi.NULL
lib.EnvSend(
self._env, instance.byref, message.encode(), args, output.byref)
return output.value | def send(self, message, arguments=None) | Send a message to the Instance.
Message arguments must be provided as a string. | 9.032118 | 8.610883 | 1.048919 |
if lib.EnvDeleteInstance(self._env, self._ist) != 1:
raise CLIPSError(self._env) | def delete(self) | Delete the instance. | 24.398216 | 19.955618 | 1.222624 |
if lib.EnvUnmakeInstance(self._env, self._ist) != 1:
raise CLIPSError(self._env) | def unmake(self) | This method is equivalent to delete except that it uses
message-passing instead of directly deleting the instance. | 22.426479 | 19.755375 | 1.135209 |
return ffi.string(lib.EnvGetDefmessageHandlerName(
self._env, self._cls, self._idx)).decode() | def name(self) | MessageHandler name. | 28.334366 | 17.025124 | 1.664268 |
return ffi.string(lib.EnvGetDefmessageHandlerType(
self._env, self._cls, self._idx)).decode() | def type(self) | MessageHandler type. | 28.298458 | 18.363289 | 1.541034 |
return bool(lib.EnvGetDefmessageHandlerWatch(
self._env, self._cls, self._idx)) | def watch(self) | True if the MessageHandler is being watched. | 54.519176 | 23.042978 | 2.365978 |
lib.EnvSetDefmessageHandlerWatch(
self._env, int(flag), self._cls, self._idx) | def watch(self, flag) | True if the MessageHandler is being watched. | 51.556286 | 28.772602 | 1.791853 |
return bool(lib.EnvIsDefmessageHandlerDeletable(
self._env, self._cls, self._idx)) | def deletable(self) | True if the MessageHandler can be deleted. | 45.14962 | 26.486128 | 1.704652 |
if lib.EnvUndefmessageHandler(self._env, self._cls, self._idx) != 1:
raise CLIPSError(self._env)
self._env = None | def undefine(self) | Undefine the MessageHandler.
Python equivalent of the CLIPS undefmessage-handler command.
The object becomes unusable after this method has been called. | 20.409437 | 13.301592 | 1.534361 |
try:
self._load_binary(path)
except CLIPSError:
self._load_text(path) | def load(self, path) | Load a set of constructs into the CLIPS data base.
Constructs can be in text or binary format.
The Python equivalent of the CLIPS load command. | 6.553931 | 4.165969 | 1.573207 |
if binary:
ret = lib.EnvBsave(self._env, path.encode())
else:
ret = lib.EnvSave(self._env, path.encode())
if ret == 0:
raise CLIPSError(self._env) | def save(self, path, binary=False) | Save a set of constructs into the CLIPS data base.
If binary is True, the constructs will be saved in binary format.
The Python equivalent of the CLIPS load command. | 4.482951 | 4.011429 | 1.117545 |
if lib.EnvBatchStar(self._env, path.encode()) != 1:
raise CLIPSError(self._env) | def batch_star(self, path) | Evaluate the commands contained in the specific path.
The Python equivalent of the CLIPS batch* command. | 15.530257 | 12.719447 | 1.220985 |
if lib.EnvBuild(self._env, construct.encode()) != 1:
raise CLIPSError(self._env) | def build(self, construct) | Build a single construct in CLIPS.
The Python equivalent of the CLIPS build command. | 22.029808 | 14.126483 | 1.559469 |
data = clips.data.DataObject(self._env)
if lib.EnvEval(self._env, construct.encode(), data.byref) != 1:
raise CLIPSError(self._env)
return data.value | def eval(self, construct) | Evaluate an expression returning its value.
The Python equivalent of the CLIPS eval command. | 13.038327 | 9.395289 | 1.387752 |
name = name if name is not None else function.__name__
ENVIRONMENT_DATA[self._env].user_functions[name] = function
self.build(DEFFUNCTION.format(name)) | def define_function(self, function, name=None) | Define the Python function within the CLIPS environment.
If a name is given, it will be the function name within CLIPS.
Otherwise, the name of the Python function will be used.
The Python function will be accessible within CLIPS via its name
as if it was defined via the `deffunction` construct. | 10.051021 | 9.34256 | 1.075832 |
if lib.EnvActivateRouter(self._env, self._name.encode()) == 0:
raise RuntimeError("Unable to activate router %s" % self._name) | def activate(self) | Activate the Router. | 8.32811 | 6.407779 | 1.299687 |
if lib.EnvDeactivateRouter(self._env, self._name.encode()) == 0:
raise RuntimeError("Unable to deactivate router %s" % self._name) | def deactivate(self) | Deactivate the Router. | 8.57513 | 6.881922 | 1.246037 |
if lib.EnvDeleteRouter(self._env, self._name.encode()) == 0:
raise RuntimeError("Unable to delete router %s" % self._name) | def delete(self) | Delete the Router. | 8.437579 | 7.002066 | 1.205013 |
self._env = environment._env
self._userdata = ffi.new_handle(self)
ENVIRONMENT_DATA[self._env].routers[self.name] = self
lib.EnvAddRouterWithContext(
self._env, self._name.encode(), self._priority,
lib.query_function,
lib.print_function,
lib.getc_function,
lib.ungetc_function,
lib.exit_function,
self._userdata) | def add_to_environment(self, environment) | Add the router to the given environment. | 9.175265 | 7.736501 | 1.185971 |
dtype = lib.get_data_type(self._data)
dvalue = lib.get_data_value(self._data)
if dvalue == ffi.NULL:
return None
return self.python_value(dtype, dvalue) | def value(self) | Return the DATA_OBJECT stored value. | 5.305476 | 4.156221 | 1.276514 |
dtype = TYPES[type(value)] if self._type is None else self._type
lib.set_data_type(self._data, dtype)
lib.set_data_value(self._data, self.clips_value(value)) | def value(self, value) | Sets the DATA_OBJECT stored value. | 6.700838 | 5.84761 | 1.145911 |
try:
return CONVERTERS[dtype](dvalue)
except KeyError:
if dtype == clips.common.CLIPSType.MULTIFIELD:
return self.multifield_to_list()
if dtype == clips.common.CLIPSType.FACT_ADDRESS:
return clips.facts.new_fact(self._env, lib.to_pointer(dvalue))
if dtype == clips.common.CLIPSType.INSTANCE_ADDRESS:
return clips.classes.Instance(self._env, lib.to_pointer(dvalue))
return None | def python_value(self, dtype, dvalue) | Convert a CLIPS type into Python. | 4.995664 | 4.362961 | 1.145017 |
try:
return VALUES[type(dvalue)](self._env, dvalue)
except KeyError:
if isinstance(dvalue, (list, tuple)):
return self.list_to_multifield(dvalue)
if isinstance(dvalue, (clips.facts.Fact)):
return dvalue._fact
if isinstance(dvalue, (clips.classes.Instance)):
return dvalue._ist
return ffi.NULL | def clips_value(self, dvalue) | Convert a Python type into CLIPS. | 5.888041 | 4.878732 | 1.206879 |
value = bool(lib.EnvGetAgendaChanged(self._env))
lib.EnvSetAgendaChanged(self._env, int(False))
return value | def agenda_changed(self) | True if any rule activation changes have occurred. | 8.222323 | 5.842283 | 1.407382 |
rule = lib.EnvGetNextDefrule(self._env, ffi.NULL)
while rule != ffi.NULL:
yield Rule(self._env, rule)
rule = lib.EnvGetNextDefrule(self._env, rule) | def rules(self) | Iterate over the defined Rules. | 5.621223 | 4.580951 | 1.227087 |
defrule = lib.EnvFindDefrule(self._env, rule.encode())
if defrule == ffi.NULL:
raise LookupError("Rule '%s' not found" % defrule)
return Rule(self._env, defrule) | def find_rule(self, rule) | Find a Rule by name. | 5.83843 | 5.213665 | 1.119832 |
module = module._mdl if module is not None else ffi.NULL
lib.EnvReorderAgenda(self._env, module) | def reorder(self, module=None) | Reorder the Activations in the Agenda.
If no Module is specified, the current one is used.
To be called after changing the conflict resolution strategy. | 22.811663 | 19.040489 | 1.198061 |
module = module._mdl if module is not None else ffi.NULL
lib.EnvRefreshAgenda(self._env, module) | def refresh(self, module=None) | Recompute the salience values of the Activations on the Agenda
and then reorder the agenda.
The Python equivalent of the CLIPS refresh-agenda command.
If no Module is specified, the current one is used. | 25.124952 | 18.399939 | 1.365491 |
activation = lib.EnvGetNextActivation(self._env, ffi.NULL)
while activation != ffi.NULL:
yield Activation(self._env, activation)
activation = lib.EnvGetNextActivation(self._env, activation) | def activations(self) | Iterate over the Activations in the Agenda. | 5.207595 | 4.145773 | 1.256121 |
if lib.EnvDeleteActivation(self._env, ffi.NULL) != 1:
raise CLIPSError(self._env) | def clear(self) | Deletes all activations in the agenda. | 22.068733 | 18.582628 | 1.1876 |
return ffi.string(lib.EnvGetDefruleName(self._env, self._rule)).decode() | def name(self) | Rule name. | 19.253664 | 11.980538 | 1.607078 |
modname = ffi.string(lib.EnvDefruleModule(self._env, self._rule))
defmodule = lib.EnvFindDefmodule(self._env, modname)
return Module(self._env, defmodule) | def module(self) | The module in which the Rule is defined.
Python equivalent of the CLIPS defrule-module command. | 9.470009 | 6.340893 | 1.493482 |
lib.EnvSetDefruleWatchFirings(self._env, int(flag), self._rule) | def watch_firings(self, flag) | Whether or not the Rule firings are being watched. | 34.049355 | 16.47315 | 2.066961 |
lib.EnvSetDefruleWatchActivations(self._env, int(flag), self._rule) | def watch_activations(self, flag) | Whether or not the Rule Activations are being watched. | 28.965931 | 17.486256 | 1.656497 |
data = clips.data.DataObject(self._env)
lib.EnvMatches(self._env, self._rule, verbosity, data.byref)
return tuple(data.value) | def matches(self, verbosity=Verbosity.TERSE) | Shows partial matches and activations.
Returns a tuple containing the combined sum of the matches
for each pattern, the combined sum of partial matches
and the number of activations.
The verbosity parameter controls how much to output:
* Verbosity.VERBOSE: detailed matches are printed to stdout
* Verbosity.SUCCINT: a brief description is printed to stdout
* Verbosity.TERSE: (default) nothing is printed to stdout | 23.823687 | 36.236897 | 0.657443 |
if lib.EnvRefresh(self._env, self._rule) != 1:
raise CLIPSError(self._env) | def refresh(self) | Refresh the Rule.
The Python equivalent of the CLIPS refresh command. | 21.993261 | 13.333292 | 1.6495 |
if lib.EnvUndefrule(self._env, self._rule) != 1:
raise CLIPSError(self._env)
self._env = None | def undefine(self) | Undefine the Rule.
Python equivalent of the CLIPS undefrule command.
The object becomes unusable after this method has been called. | 17.861065 | 12.454579 | 1.434096 |
return ffi.string(
lib.EnvGetActivationName(self._env, self._act)).decode() | def name(self) | Activation Rule name. | 22.420652 | 14.500639 | 1.546184 |
lib.EnvSetActivationSalience(self._env, self._act, salience) | def salience(self, salience) | Activation salience value. | 19.993507 | 11.204405 | 1.784433 |
if lib.EnvDeleteActivation(self._env, self._act) != 1:
raise CLIPSError(self._env)
self._env = None | def delete(self) | Remove the activation from the agenda. | 15.846652 | 12.692631 | 1.248492 |
value = bool(lib.EnvGetGlobalsChanged(self._env))
lib.EnvSetGlobalsChanged(self._env, int(False))
return value | def globals_changed(self) | True if any Global has changed. | 9.204821 | 6.49395 | 1.417446 |
defglobal = lib.EnvGetNextDefglobal(self._env, ffi.NULL)
while defglobal != ffi.NULL:
yield Global(self._env, defglobal)
defglobal = lib.EnvGetNextDefglobal(self._env, defglobal) | def globals(self) | Iterates over the defined Globals. | 6.197001 | 4.712091 | 1.315128 |
defglobal = lib.EnvFindDefglobal(self._env, name.encode())
if defglobal == ffi.NULL:
raise LookupError("Global '%s' not found" % name)
return Global(self._env, defglobal) | def find_global(self, name) | Find the Global by its name. | 5.262553 | 4.468555 | 1.177685 |
defmodule = lib.EnvGetNextDefmodule(self._env, ffi.NULL)
while defmodule != ffi.NULL:
yield Module(self._env, defmodule)
defmodule = lib.EnvGetNextDefmodule(self._env, defmodule) | def modules(self) | Iterates over the defined Modules. | 5.34978 | 4.473569 | 1.195864 |
defmodule = lib.EnvFindDefmodule(self._env, name.encode())
if defmodule == ffi.NULL:
raise LookupError("Module '%s' not found" % name)
return Module(self._env, defmodule) | def find_module(self, name) | Find the Module by its name. | 5.238889 | 4.428072 | 1.183108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.