Skip to content

Commit da66f6b

Browse files
committed
Removed Tool class from model/__init__.py
(migrated to model/tool.py to avoid circular imports)
1 parent fd4772b commit da66f6b

File tree

1 file changed

+0
-125
lines changed

1 file changed

+0
-125
lines changed

cyclonedx/model/__init__.py

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,131 +1069,6 @@ def __repr__(self) -> str:
10691069
return f'<Note id={id(self)}, locale={self.locale}>'
10701070

10711071

1072-
@serializable.serializable_class
1073-
class Tool:
1074-
"""
1075-
This is our internal representation of the `toolType` complex type within the CycloneDX standard.
1076-
1077-
Tool(s) are the things used in the creation of the CycloneDX document.
1078-
1079-
Tool might be deprecated since CycloneDX 1.5, but it is not deprecated in this library.
1080-
In fact, this library will try to provide a compatibility layer if needed.
1081-
1082-
.. note::
1083-
See the CycloneDX Schema for toolType: https://cyclonedx.org/docs/1.3/#type_toolType
1084-
"""
1085-
1086-
def __init__(self, *, vendor: Optional[str] = None, name: Optional[str] = None, version: Optional[str] = None,
1087-
hashes: Optional[Iterable[HashType]] = None,
1088-
external_references: Optional[Iterable[ExternalReference]] = None) -> None:
1089-
self.vendor = vendor
1090-
self.name = name
1091-
self.version = version
1092-
self.hashes = hashes or [] # type:ignore[assignment]
1093-
self.external_references = external_references or [] # type:ignore[assignment]
1094-
1095-
@property
1096-
@serializable.xml_sequence(1)
1097-
def vendor(self) -> Optional[str]:
1098-
"""
1099-
The name of the vendor who created the tool.
1100-
1101-
Returns:
1102-
`str` if set else `None`
1103-
"""
1104-
return self._vendor
1105-
1106-
@vendor.setter
1107-
def vendor(self, vendor: Optional[str]) -> None:
1108-
self._vendor = vendor
1109-
1110-
@property
1111-
@serializable.xml_sequence(2)
1112-
def name(self) -> Optional[str]:
1113-
"""
1114-
The name of the tool.
1115-
1116-
Returns:
1117-
`str` if set else `None`
1118-
"""
1119-
return self._name
1120-
1121-
@name.setter
1122-
def name(self, name: Optional[str]) -> None:
1123-
self._name = name
1124-
1125-
@property
1126-
@serializable.xml_sequence(3)
1127-
def version(self) -> Optional[str]:
1128-
"""
1129-
The version of the tool.
1130-
1131-
Returns:
1132-
`str` if set else `None`
1133-
"""
1134-
return self._version
1135-
1136-
@version.setter
1137-
def version(self, version: Optional[str]) -> None:
1138-
self._version = version
1139-
1140-
@property
1141-
@serializable.type_mapping(_HashTypeRepositorySerializationHelper)
1142-
@serializable.xml_sequence(4)
1143-
def hashes(self) -> 'SortedSet[HashType]':
1144-
"""
1145-
The hashes of the tool (if applicable).
1146-
1147-
Returns:
1148-
Set of `HashType`
1149-
"""
1150-
return self._hashes
1151-
1152-
@hashes.setter
1153-
def hashes(self, hashes: Iterable[HashType]) -> None:
1154-
self._hashes = SortedSet(hashes)
1155-
1156-
@property
1157-
@serializable.view(SchemaVersion1Dot4)
1158-
@serializable.view(SchemaVersion1Dot5)
1159-
@serializable.view(SchemaVersion1Dot6)
1160-
@serializable.xml_array(serializable.XmlArraySerializationType.NESTED, 'reference')
1161-
@serializable.xml_sequence(5)
1162-
def external_references(self) -> 'SortedSet[ExternalReference]':
1163-
"""
1164-
External References provides a way to document systems, sites, and information that may be relevant but which
1165-
are not included with the BOM.
1166-
1167-
Returns:
1168-
Set of `ExternalReference`
1169-
"""
1170-
return self._external_references
1171-
1172-
@external_references.setter
1173-
def external_references(self, external_references: Iterable[ExternalReference]) -> None:
1174-
self._external_references = SortedSet(external_references)
1175-
1176-
def __eq__(self, other: object) -> bool:
1177-
if isinstance(other, Tool):
1178-
return hash(other) == hash(self)
1179-
return False
1180-
1181-
def __lt__(self, other: Any) -> bool:
1182-
if isinstance(other, Tool):
1183-
return _ComparableTuple((
1184-
self.vendor, self.name, self.version
1185-
)) < _ComparableTuple((
1186-
other.vendor, other.name, other.version
1187-
))
1188-
return NotImplemented
1189-
1190-
def __hash__(self) -> int:
1191-
return hash((self.vendor, self.name, self.version, tuple(self.hashes), tuple(self.external_references)))
1192-
1193-
def __repr__(self) -> str:
1194-
return f'<Tool name={self.name}, version={self.version}, vendor={self.vendor}>'
1195-
1196-
11971072
@serializable.serializable_class
11981073
class IdentifiableAction:
11991074
"""

0 commit comments

Comments
 (0)