| 
34 | 34 | import serializable  | 
35 | 35 | from sortedcontainers import SortedSet  | 
36 | 36 | 
 
  | 
37 |  | -from .. import __version__ as __ThisToolVersion  # noqa: N812  | 
38 | 37 | from .._internal.compare import ComparableTuple as _ComparableTuple  | 
39 | 38 | from ..exception.model import (  | 
40 | 39 |     InvalidLocaleTypeException,  | 
@@ -1129,139 +1128,6 @@ def __repr__(self) -> str:  | 
1129 | 1128 |         return f'<Note id={id(self)}, locale={self.locale}>'  | 
1130 | 1129 | 
 
  | 
1131 | 1130 | 
 
  | 
1132 |  | -@serializable.serializable_class  | 
1133 |  | -class Tool:  | 
1134 |  | -    """  | 
1135 |  | -    This is our internal representation of the `toolType` complex type within the CycloneDX standard.  | 
1136 |  | -
  | 
1137 |  | -    Tool(s) are the things used in the creation of the CycloneDX document.  | 
1138 |  | -
  | 
1139 |  | -    Tool might be deprecated since CycloneDX 1.5, but it is not deprecated in this library.  | 
1140 |  | -    In fact, this library will try to provide a compatibility layer if needed.  | 
1141 |  | -
  | 
1142 |  | -    .. note::  | 
1143 |  | -        See the CycloneDX Schema for toolType: https://cyclonedx.org/docs/1.3/#type_toolType  | 
1144 |  | -    """  | 
1145 |  | - | 
1146 |  | -    def __init__(  | 
1147 |  | -        self, *,  | 
1148 |  | -        vendor: Optional[str] = None,  | 
1149 |  | -        name: Optional[str] = None,  | 
1150 |  | -        version: Optional[str] = None,  | 
1151 |  | -        hashes: Optional[Iterable[HashType]] = None,  | 
1152 |  | -        external_references: Optional[Iterable[ExternalReference]] = None,  | 
1153 |  | -    ) -> None:  | 
1154 |  | -        self.vendor = vendor  | 
1155 |  | -        self.name = name  | 
1156 |  | -        self.version = version  | 
1157 |  | -        self.hashes = hashes or []  # type:ignore[assignment]  | 
1158 |  | -        self.external_references = external_references or []  # type:ignore[assignment]  | 
1159 |  | - | 
1160 |  | -    @property  | 
1161 |  | -    @serializable.xml_sequence(1)  | 
1162 |  | -    @serializable.xml_string(serializable.XmlStringSerializationType.NORMALIZED_STRING)  | 
1163 |  | -    def vendor(self) -> Optional[str]:  | 
1164 |  | -        """  | 
1165 |  | -        The name of the vendor who created the tool.  | 
1166 |  | -
  | 
1167 |  | -        Returns:  | 
1168 |  | -            `str` if set else `None`  | 
1169 |  | -        """  | 
1170 |  | -        return self._vendor  | 
1171 |  | - | 
1172 |  | -    @vendor.setter  | 
1173 |  | -    def vendor(self, vendor: Optional[str]) -> None:  | 
1174 |  | -        self._vendor = vendor  | 
1175 |  | - | 
1176 |  | -    @property  | 
1177 |  | -    @serializable.xml_sequence(2)  | 
1178 |  | -    @serializable.xml_string(serializable.XmlStringSerializationType.NORMALIZED_STRING)  | 
1179 |  | -    def name(self) -> Optional[str]:  | 
1180 |  | -        """  | 
1181 |  | -        The name of the tool.  | 
1182 |  | -
  | 
1183 |  | -        Returns:  | 
1184 |  | -             `str` if set else `None`  | 
1185 |  | -        """  | 
1186 |  | -        return self._name  | 
1187 |  | - | 
1188 |  | -    @name.setter  | 
1189 |  | -    def name(self, name: Optional[str]) -> None:  | 
1190 |  | -        self._name = name  | 
1191 |  | - | 
1192 |  | -    @property  | 
1193 |  | -    @serializable.xml_sequence(3)  | 
1194 |  | -    @serializable.xml_string(serializable.XmlStringSerializationType.NORMALIZED_STRING)  | 
1195 |  | -    def version(self) -> Optional[str]:  | 
1196 |  | -        """  | 
1197 |  | -        The version of the tool.  | 
1198 |  | -
  | 
1199 |  | -        Returns:  | 
1200 |  | -             `str` if set else `None`  | 
1201 |  | -        """  | 
1202 |  | -        return self._version  | 
1203 |  | - | 
1204 |  | -    @version.setter  | 
1205 |  | -    def version(self, version: Optional[str]) -> None:  | 
1206 |  | -        self._version = version  | 
1207 |  | - | 
1208 |  | -    @property  | 
1209 |  | -    @serializable.type_mapping(_HashTypeRepositorySerializationHelper)  | 
1210 |  | -    @serializable.xml_sequence(4)  | 
1211 |  | -    def hashes(self) -> 'SortedSet[HashType]':  | 
1212 |  | -        """  | 
1213 |  | -        The hashes of the tool (if applicable).  | 
1214 |  | -
  | 
1215 |  | -        Returns:  | 
1216 |  | -            Set of `HashType`  | 
1217 |  | -        """  | 
1218 |  | -        return self._hashes  | 
1219 |  | - | 
1220 |  | -    @hashes.setter  | 
1221 |  | -    def hashes(self, hashes: Iterable[HashType]) -> None:  | 
1222 |  | -        self._hashes = SortedSet(hashes)  | 
1223 |  | - | 
1224 |  | -    @property  | 
1225 |  | -    @serializable.view(SchemaVersion1Dot4)  | 
1226 |  | -    @serializable.view(SchemaVersion1Dot5)  | 
1227 |  | -    @serializable.view(SchemaVersion1Dot6)  | 
1228 |  | -    @serializable.xml_array(serializable.XmlArraySerializationType.NESTED, 'reference')  | 
1229 |  | -    @serializable.xml_sequence(5)  | 
1230 |  | -    def external_references(self) -> 'SortedSet[ExternalReference]':  | 
1231 |  | -        """  | 
1232 |  | -        External References provides a way to document systems, sites, and information that may be relevant but which  | 
1233 |  | -        are not included with the BOM.  | 
1234 |  | -
  | 
1235 |  | -        Returns:  | 
1236 |  | -            Set of `ExternalReference`  | 
1237 |  | -        """  | 
1238 |  | -        return self._external_references  | 
1239 |  | - | 
1240 |  | -    @external_references.setter  | 
1241 |  | -    def external_references(self, external_references: Iterable[ExternalReference]) -> None:  | 
1242 |  | -        self._external_references = SortedSet(external_references)  | 
1243 |  | - | 
1244 |  | -    def __eq__(self, other: object) -> bool:  | 
1245 |  | -        if isinstance(other, Tool):  | 
1246 |  | -            return hash(other) == hash(self)  | 
1247 |  | -        return False  | 
1248 |  | - | 
1249 |  | -    def __lt__(self, other: Any) -> bool:  | 
1250 |  | -        if isinstance(other, Tool):  | 
1251 |  | -            return _ComparableTuple((  | 
1252 |  | -                self.vendor, self.name, self.version  | 
1253 |  | -            )) < _ComparableTuple((  | 
1254 |  | -                other.vendor, other.name, other.version  | 
1255 |  | -            ))  | 
1256 |  | -        return NotImplemented  | 
1257 |  | - | 
1258 |  | -    def __hash__(self) -> int:  | 
1259 |  | -        return hash((self.vendor, self.name, self.version, tuple(self.hashes), tuple(self.external_references)))  | 
1260 |  | - | 
1261 |  | -    def __repr__(self) -> str:  | 
1262 |  | -        return f'<Tool name={self.name}, version={self.version}, vendor={self.vendor}>'  | 
1263 |  | - | 
1264 |  | - | 
1265 | 1131 | @serializable.serializable_class  | 
1266 | 1132 | class IdentifiableAction:  | 
1267 | 1133 |     """  | 
@@ -1397,43 +1263,3 @@ def __hash__(self) -> int:  | 
1397 | 1263 | 
 
  | 
1398 | 1264 |     def __repr__(self) -> str:  | 
1399 | 1265 |         return f'<Copyright text={self.text}>'  | 
1400 |  | - | 
1401 |  | - | 
1402 |  | -ThisTool = Tool(  | 
1403 |  | -    vendor='CycloneDX',  | 
1404 |  | -    name='cyclonedx-python-lib',  | 
1405 |  | -    version=__ThisToolVersion or 'UNKNOWN',  | 
1406 |  | -    external_references=[  | 
1407 |  | -        ExternalReference(  | 
1408 |  | -            type=ExternalReferenceType.BUILD_SYSTEM,  | 
1409 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib/actions')  | 
1410 |  | -        ),  | 
1411 |  | -        ExternalReference(  | 
1412 |  | -            type=ExternalReferenceType.DISTRIBUTION,  | 
1413 |  | -            url=XsUri('https://pypi.org/project/cyclonedx-python-lib/')  | 
1414 |  | -        ),  | 
1415 |  | -        ExternalReference(  | 
1416 |  | -            type=ExternalReferenceType.DOCUMENTATION,  | 
1417 |  | -            url=XsUri('https://cyclonedx-python-library.readthedocs.io/')  | 
1418 |  | -        ),  | 
1419 |  | -        ExternalReference(  | 
1420 |  | -            type=ExternalReferenceType.ISSUE_TRACKER,  | 
1421 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib/issues')  | 
1422 |  | -        ),  | 
1423 |  | -        ExternalReference(  | 
1424 |  | -            type=ExternalReferenceType.LICENSE,  | 
1425 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE')  | 
1426 |  | -        ),  | 
1427 |  | -        ExternalReference(  | 
1428 |  | -            type=ExternalReferenceType.RELEASE_NOTES,  | 
1429 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md')  | 
1430 |  | -        ),  | 
1431 |  | -        ExternalReference(  | 
1432 |  | -            type=ExternalReferenceType.VCS,  | 
1433 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib')  | 
1434 |  | -        ),  | 
1435 |  | -        ExternalReference(  | 
1436 |  | -            type=ExternalReferenceType.WEBSITE,  | 
1437 |  | -            url=XsUri('https://github.com/CycloneDX/cyclonedx-python-lib/#readme')  | 
1438 |  | -        )  | 
1439 |  | -    ])  | 
0 commit comments