@@ -50,21 +50,6 @@ class Component:
50
50
.. note::
51
51
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_component
52
52
"""
53
- _type : ComponentType
54
- _package_url_type : str
55
- _namespace : str
56
- _name : str
57
- _version : str
58
- _qualifiers : str
59
- _subpath : str
60
-
61
- _author : str = None
62
- _description : str = None
63
- _license : str = None
64
-
65
- _hashes : List [HashType ] = []
66
- _vulnerabilites : List [Vulnerability ] = []
67
- _external_references : List [ExternalReference ] = []
68
53
69
54
@staticmethod
70
55
def for_file (absolute_file_path : str , path_for_bom : str = None ):
@@ -96,7 +81,7 @@ def for_file(absolute_file_path: str, path_for_bom: str = None):
96
81
)
97
82
98
83
def __init__ (self , name : str , version : str , namespace : str = None , qualifiers : str = None , subpath : str = None ,
99
- hashes : List [HashType ] = None ,
84
+ hashes : List [HashType ] = None , author : str = None , description : str = None , license_str : str = None ,
100
85
component_type : ComponentType = ComponentType .LIBRARY , package_url_type : str = 'pypi' ):
101
86
self ._package_url_type = package_url_type
102
87
self ._namespace = namespace
@@ -106,11 +91,13 @@ def __init__(self, name: str, version: str, namespace: str = None, qualifiers: s
106
91
self ._qualifiers = qualifiers
107
92
self ._subpath = subpath
108
93
109
- self ._hashes .clear ()
110
- if hashes :
111
- self ._hashes = hashes
112
- self ._vulnerabilites .clear ()
113
- self ._external_references .clear ()
94
+ self ._author : str = author
95
+ self ._description : str = description
96
+ self ._license : str = license_str
97
+
98
+ self ._hashes : List [HashType ] = hashes if hashes else []
99
+ self ._vulnerabilites : List [Vulnerability ] = []
100
+ self ._external_references : List [ExternalReference ] = []
114
101
115
102
def add_external_reference (self , reference : ExternalReference ):
116
103
"""
@@ -122,15 +109,15 @@ def add_external_reference(self, reference: ExternalReference):
122
109
"""
123
110
self ._external_references .append (reference )
124
111
125
- def add_hash (self , hash : HashType ):
112
+ def add_hash (self , a_hash : HashType ):
126
113
"""
127
114
Adds a hash that pins/identifies this Component.
128
115
129
116
Args:
130
- hash :
117
+ a_hash :
131
118
`HashType` instance
132
119
"""
133
- self ._hashes .append (hash )
120
+ self ._hashes .append (a_hash )
134
121
135
122
def add_vulnerability (self , vulnerability : Vulnerability ):
136
123
"""
0 commit comments