Skip to content

Commit a1bbf00

Browse files
committed
updated to be more pythonic
Signed-off-by: Paul Horton <[email protected]>
1 parent ba0c82f commit a1bbf00

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cyclonedx/output/json.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ def _recurse_specialise_component(self, bom_json: Dict[Any, Any], base_key: str
151151
if not self.component_supports_author() and 'author' in bom_json[base_key][i].keys():
152152
del bom_json[base_key][i]['author']
153153

154-
if self.component_version_optional() and 'version' in bom_json[base_key][i].keys() and \
155-
bom_json[base_key][i]['version'] == "":
154+
if self.component_version_optional() and bom_json[base_key][i].get('version', '') == "":
156155
del bom_json[base_key][i]['version']
157156

158157
if not self.component_supports_pedigree() and 'pedigree' in bom_json[base_key][i].keys():

0 commit comments

Comments
 (0)