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

Method export

stix/bindings/ttp.py:88–103  ·  view source on GitHub ↗
(self, lwrite, level, nsmap, namespace_=XML_NS, name_='AttackPatternType', namespacedef_='', pretty_print=True)

Source from the content-addressed store, hash-verified

86 else:
87 return False
88 def export(self, lwrite, level, nsmap, namespace_=XML_NS, name_='AttackPatternType', namespacedef_='', pretty_print=True):
89 if pretty_print:
90 eol_ = '\n'
91 else:
92 eol_ = ''
93 showIndent(lwrite, level, pretty_print)
94 lwrite('<%s:%s%s' % (nsmap[namespace_], name_, namespacedef_ and ' ' + namespacedef_ or '', ))
95 already_processed = set()
96 self.exportAttributes(lwrite, level, already_processed, namespace_, name_='AttackPatternType')
97 if self.hasContent_():
98 lwrite('>%s' % (eol_, ))
99 self.exportChildren(lwrite, level + 1, nsmap, XML_NS, name_, pretty_print=pretty_print)
100 showIndent(lwrite, level, pretty_print)
101 lwrite('</%s:%s>%s' % (nsmap[namespace_], name_, eol_))
102 else:
103 lwrite('/>%s' % (eol_, ))
104 def exportAttributes(self, lwrite, level, already_processed, namespace_='ttp:', name_='AttackPatternType'):
105 if self.idref is not None and 'idref' not in already_processed:
106 already_processed.add('idref')

Callers

nothing calls this directly

Calls 3

exportAttributesMethod · 0.95
hasContent_Method · 0.95
exportChildrenMethod · 0.95

Tested by

no test coverage detected