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

Method to_obj

stix/common/structured_text.py:319–340  ·  view source on GitHub ↗

Returns a binding object list for the StructuredTextList. If the list has a length of 1, and its member has an ordinality of 1, the ordinality will be unset.

(self, ns_info=None)

Source from the content-addressed store, hash-verified

317 self._inner.remove(value)
318
319 def to_obj(self, ns_info=None):
320 """Returns a binding object list for the StructuredTextList.
321
322 If the list has a length of 1, and its member has an ordinality of 1,
323 the ordinality will be unset.
324
325 """
326 #print "STList to_obj called"
327
328 if not self:
329 return []
330
331 if len(self) > 1:
332 return super(StructuredTextList, self).to_obj(ns_info=ns_info)
333
334 # One item. Temporarily unset the ordinality if its the default value.
335 text = self._inner[0]
336
337 with _unset_default(text):
338 l = [text.to_obj(ns_info=ns_info)]
339
340 return l
341
342 def to_list(self):
343 """Returns a list of dictionary representations of the contained

Callers

nothing calls this directly

Calls 1

_unset_defaultFunction · 0.85

Tested by

no test coverage detected