src/eric7/CycloneDXInterface/CycloneDXUtilities.py

branch
eric7
changeset 10170
6cf1ee737d8f
parent 9674
43dd357b3bff
child 10439
21c28b0f9e41
equal deleted inserted replaced
10169:0f70a4ef4592 10170:6cf1ee737d8f
9 9
10 import contextlib 10 import contextlib
11 import json 11 import json
12 import os 12 import os
13 13
14 from xml.etree import ElementTree 14 from xml.etree import ElementTree # secok
15 15
16 from cyclonedx.model import ( 16 from cyclonedx.model import (
17 ExternalReference, 17 ExternalReference,
18 ExternalReferenceType, 18 ExternalReferenceType,
19 LicenseChoice, 19 LicenseChoice,
205 @param inputStr output generated by CycloneDX 205 @param inputStr output generated by CycloneDX
206 @type str 206 @type str
207 @return prettified SBOM string 207 @return prettified SBOM string
208 @rtype str 208 @rtype str
209 """ 209 """
210 tree = ElementTree.fromstring(inputStr) 210 tree = ElementTree.fromstring(inputStr) # secok
211 with contextlib.suppress(AttributeError): 211 with contextlib.suppress(AttributeError):
212 ElementTree.indent(tree) 212 ElementTree.indent(tree)
213 return '<?xml version="1.0" encoding="UTF-8"?>\n' + ElementTree.tostring( 213 return '<?xml version="1.0" encoding="UTF-8"?>\n' + ElementTree.tostring(
214 tree, encoding="unicode" 214 tree, encoding="unicode"
215 ) 215 )

eric ide

mercurial