MCPcopy Create free account
hub / github.com/STIXProject/python-stix / add_object

Method add_object

stix/indicator/indicator.py:700–724  ·  view source on GitHub ↗

Adds a python-cybox Object instance to the ``observables`` list property. This is the same as calling ``indicator.add_observable(object_)``. Note: If the `object` param is not an instance of ``cybox.core.Object`` an attempt will be made to to convert

(self, object_)

Source from the content-addressed store, hash-verified

698 return root_observable
699
700 def add_object(self, object_):
701 """Adds a python-cybox Object instance to the ``observables`` list
702 property.
703
704 This is the same as calling ``indicator.add_observable(object_)``.
705
706 Note:
707 If the `object` param is not an instance of ``cybox.core.Object``
708 an attempt will be made to to convert it into one before wrapping
709 it in an ``cybox.core.Observable`` layer.
710
711 Args:
712 object_: An instance of ``cybox.core.Object`` or an object
713 that can be converted into an instance of
714 ``cybox.core.Observable``
715
716 Raises:
717 ValueError: if the `object_` param cannot be converted to an
718 instance of ``cybox.core.Observable``.
719 """
720 if not object_:
721 return
722
723 observable = Observable(object_)
724 self.add_observable(observable)
725
726 def _finalize_obj(self, entity_obj):
727 """Omits the `negate` field if it is not equal to True.

Callers 2

mainFunction · 0.95
mainFunction · 0.95

Calls 1

add_observableMethod · 0.95

Tested by

no test coverage detected