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

Class IndicatorTypes

stix/indicator/indicator.py:850–891  ·  view source on GitHub ↗

A :class:`stix.common.vocabs.VocabString` collection which defaults to :class:`stix.common.vocabs.IndicatorType`. This class implements methods found on ``collections.MutableSequence`` and as such can be interacted with like a ``list``. Note: The ``append()`` method can acce

Source from the content-addressed store, hash-verified

848
849# NOT ACTUAL STIX TYPES!
850class IndicatorTypes(stix.TypedList):
851 """A :class:`stix.common.vocabs.VocabString` collection which defaults to
852 :class:`stix.common.vocabs.IndicatorType`. This class implements methods
853 found on ``collections.MutableSequence`` and as such can be interacted with
854 like a ``list``.
855
856 Note:
857 The ``append()`` method can accept ``str`` or
858 :class:`stix.common.vocabs.VocabString` instances. If a ``str`` instance
859 is passed in, an attempt will be made to convert it to an instance of
860 :class:`stix.common.vocabs.IndicatorType`.
861
862 Examples:
863 Add an instance of :class:`stix.common.vocabs.IndicatorType`:
864
865 >>> from stix.common.vocabs import IndicatorType
866 >>> itypes = IndicatorTypes()
867 >>> type_ = IndicatorType(IndicatorType.TERM_IP_WATCHLIST)
868 >>> itypes.append(type_)
869 >>> print(len(itypes))
870 1
871
872 Add a string value:
873
874 >>> from stix.common.vocabs import IndicatorType
875 >>> itypes = IndicatorTypes()
876 >>> type(IndicatorType.TERM_IP_WATCHLIST)
877 <type 'str'>
878 >>> itypes.append(IndicatorType.TERM_IP_WATCHLIST)
879 >>> print(len(itypes))
880 1
881
882 Args:
883 *args: Variable length argument list of strings or
884 :class:`stix.common.vocabs.VocabString` instances.
885
886 """
887 _namespace = "http://docs.oasis-open.org/cti/ns/stix/indicator-1"
888 _contained_type = VocabString
889
890 def _fix_value(self, value):
891 return IndicatorType(value)
892
893
894class _Observables(stix.TypedList):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected