spdx_tools.spdx3.model.bundle

 1# SPDX-FileCopyrightText: 2023 spdx contributors
 2#
 3# SPDX-License-Identifier: Apache-2.0
 4from beartype.typing import List, Optional
 5
 6from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
 7from spdx_tools.common.typing.type_checks import check_types_and_set_values
 8from spdx_tools.spdx3.model import (
 9    CreationInfo,
10    ElementCollection,
11    ExternalIdentifier,
12    ExternalMap,
13    ExternalReference,
14    IntegrityMethod,
15    NamespaceMap,
16)
17
18
19@dataclass_with_properties
20class Bundle(ElementCollection):
21    context: Optional[str] = None
22
23    def __init__(
24        self,
25        spdx_id: str,
26        element: List[str],
27        root_element: List[str],
28        creation_info: Optional[CreationInfo] = None,
29        name: Optional[str] = None,
30        summary: Optional[str] = None,
31        description: Optional[str] = None,
32        comment: Optional[str] = None,
33        verified_using: List[IntegrityMethod] = None,
34        external_reference: List[ExternalReference] = None,
35        external_identifier: List[ExternalIdentifier] = None,
36        extension: Optional[str] = None,
37        namespaces: List[NamespaceMap] = None,
38        imports: List[ExternalMap] = None,
39        context: Optional[str] = None,
40    ):
41        verified_using = [] if verified_using is None else verified_using
42        external_reference = [] if external_reference is None else external_reference
43        external_identifier = [] if external_identifier is None else external_identifier
44        namespaces = [] if namespaces is None else namespaces
45        imports = [] if imports is None else imports
46        check_types_and_set_values(self, locals())
@dataclass_with_properties
class Bundle(spdx_tools.spdx3.model.spdx_collection.ElementCollection):
20@dataclass_with_properties
21class Bundle(ElementCollection):
22    context: Optional[str] = None
23
24    def __init__(
25        self,
26        spdx_id: str,
27        element: List[str],
28        root_element: List[str],
29        creation_info: Optional[CreationInfo] = None,
30        name: Optional[str] = None,
31        summary: Optional[str] = None,
32        description: Optional[str] = None,
33        comment: Optional[str] = None,
34        verified_using: List[IntegrityMethod] = None,
35        external_reference: List[ExternalReference] = None,
36        external_identifier: List[ExternalIdentifier] = None,
37        extension: Optional[str] = None,
38        namespaces: List[NamespaceMap] = None,
39        imports: List[ExternalMap] = None,
40        context: Optional[str] = None,
41    ):
42        verified_using = [] if verified_using is None else verified_using
43        external_reference = [] if external_reference is None else external_reference
44        external_identifier = [] if external_identifier is None else external_identifier
45        namespaces = [] if namespaces is None else namespaces
46        imports = [] if imports is None else imports
47        check_types_and_set_values(self, locals())
Bundle( spdx_id: str, element: list[str], root_element: list[str], creation_info: Optional[spdx_tools.spdx3.model.creation_info.CreationInfo] = None, name: Optional[str] = None, summary: Optional[str] = None, description: Optional[str] = None, comment: Optional[str] = None, verified_using: list[spdx_tools.spdx3.model.integrity_method.IntegrityMethod] = None, external_reference: list[spdx_tools.spdx3.model.external_reference.ExternalReference] = None, external_identifier: list[spdx_tools.spdx3.model.external_identifier.ExternalIdentifier] = None, extension: Optional[str] = None, namespaces: list[spdx_tools.spdx3.model.namespace_map.NamespaceMap] = None, imports: list[spdx_tools.spdx3.model.external_map.ExternalMap] = None, context: Optional[str] = None)
24    def __init__(
25        self,
26        spdx_id: str,
27        element: List[str],
28        root_element: List[str],
29        creation_info: Optional[CreationInfo] = None,
30        name: Optional[str] = None,
31        summary: Optional[str] = None,
32        description: Optional[str] = None,
33        comment: Optional[str] = None,
34        verified_using: List[IntegrityMethod] = None,
35        external_reference: List[ExternalReference] = None,
36        external_identifier: List[ExternalIdentifier] = None,
37        extension: Optional[str] = None,
38        namespaces: List[NamespaceMap] = None,
39        imports: List[ExternalMap] = None,
40        context: Optional[str] = None,
41    ):
42        verified_using = [] if verified_using is None else verified_using
43        external_reference = [] if external_reference is None else external_reference
44        external_identifier = [] if external_identifier is None else external_identifier
45        namespaces = [] if namespaces is None else namespaces
46        imports = [] if imports is None else imports
47        check_types_and_set_values(self, locals())
context: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")