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

Method to_dict

stix/common/structured_text.py:57–69  ·  view source on GitHub ↗

Converts this object into a dictionary representation. Note: If no properies or attributes are set other than ``value``, this will return a string.

(self)

Source from the content-addressed store, hash-verified

55 return plain
56
57 def to_dict(self):
58 """Converts this object into a dictionary representation.
59
60 Note:
61 If no properies or attributes are set other than ``value``,
62 this will return a string.
63
64 """
65 # Return a plain string if there is no format specified.
66 if self.is_plain():
67 return self.value
68 else:
69 return super(StructuredText, self).to_dict()
70
71 def __str__(self):
72 """Returns a UTF-8 encoded string representation of the ``value``.

Callers 1

to_listMethod · 0.45

Calls 1

is_plainMethod · 0.95

Tested by

no test coverage detected