14
14
# Copyright (c) OWASP Foundation. All Rights Reserved.
15
15
16
16
17
- from typing import Optional , Union , Any , Iterable
17
+ from typing import Any , Iterable , Optional , Union
18
18
19
19
import serializable
20
20
from sortedcontainers import SortedSet
@@ -41,10 +41,8 @@ def __init__(self, *, bom_ref: Optional[Union[str, BomRef]] = None, country: Opt
41
41
region : Optional [str ] = None , locality : Optional [str ] = None ,
42
42
post_office_box_number : Optional [str ] = None , postal_code : Optional [str ] = None ,
43
43
street_address : Optional [str ] = None ) -> None :
44
- if isinstance (bom_ref , BomRef ):
45
- self ._bom_ref = bom_ref
46
- else :
47
- self ._bom_ref = BomRef (value = bom_ref ) if bom_ref else None
44
+ self ._bom_ref = bom_ref if isinstance (bom_ref , BomRef ) else BomRef (
45
+ value = bom_ref ) if bom_ref else None
48
46
self .country = country
49
47
self .region = region
50
48
self .locality = locality
@@ -57,7 +55,7 @@ def __init__(self, *, bom_ref: Optional[Union[str, BomRef]] = None, country: Opt
57
55
@serializable .type_mapping (BomRefHelper )
58
56
@serializable .xml_attribute ()
59
57
@serializable .xml_name ('bom-ref' )
60
- def bom_ref (self ) -> BomRef :
58
+ def bom_ref (self ) -> Optional [ BomRef ] :
61
59
"""
62
60
An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be
63
61
unique within the BOM.
0 commit comments