spdx_tools.spdx3.model.spdx_document

 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    Bundle,
10    CreationInfo,
11    ExternalIdentifier,
12    ExternalMap,
13    ExternalReference,
14    IntegrityMethod,
15    NamespaceMap,
16)
17
18
19@dataclass_with_properties
20class SpdxDocument(Bundle):
21    # The inherited field "name" is required for a SpdxDocument, no longer optional.
22    # We overwrite the super-__init__ as check_types_and_set_values()
23    # takes care of all fields (including inherited ones).
24    def __init__(
25        self,
26        spdx_id: str,
27        name: str,
28        element: List[str],
29        root_element: List[str],
30        creation_info: Optional[CreationInfo] = 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())
@dataclass_with_properties
class SpdxDocument(spdx_tools.spdx3.model.bundle.Bundle):
20@dataclass_with_properties
21class SpdxDocument(Bundle):
22    # The inherited field "name" is required for a SpdxDocument, no longer optional.
23    # We overwrite the super-__init__ as check_types_and_set_values()
24    # takes care of all fields (including inherited ones).
25    def __init__(
26        self,
27        spdx_id: str,
28        name: str,
29        element: List[str],
30        root_element: List[str],
31        creation_info: Optional[CreationInfo] = None,
32        summary: Optional[str] = None,
33        description: Optional[str] = None,
34        comment: Optional[str] = None,
35        verified_using: List[IntegrityMethod] = None,
36        external_reference: List[ExternalReference] = None,
37        external_identifier: List[ExternalIdentifier] = None,
38        extension: Optional[str] = None,
39        namespaces: List[NamespaceMap] = None,
40        imports: List[ExternalMap] = None,
41        context: Optional[str] = None,
42    ):
43        verified_using = [] if verified_using is None else verified_using
44        external_reference = [] if external_reference is None else external_reference
45        external_identifier = [] if external_identifier is None else external_identifier
46        namespaces = [] if namespaces is None else namespaces
47        imports = [] if imports is None else imports
48        check_types_and_set_values(self, locals())
SpdxDocument( spdx_id: str, name: str, element: list[str], root_element: list[str], creation_info: Optional[spdx_tools.spdx3.model.creation_info.CreationInfo] = 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)
25    def __init__(
26        self,
27        spdx_id: str,
28        name: str,
29        element: List[str],
30        root_element: List[str],
31        creation_info: Optional[CreationInfo] = None,
32        summary: Optional[str] = None,
33        description: Optional[str] = None,
34        comment: Optional[str] = None,
35        verified_using: List[IntegrityMethod] = None,
36        external_reference: List[ExternalReference] = None,
37        external_identifier: List[ExternalIdentifier] = None,
38        extension: Optional[str] = None,
39        namespaces: List[NamespaceMap] = None,
40        imports: List[ExternalMap] = None,
41        context: Optional[str] = None,
42    ):
43        verified_using = [] if verified_using is None else verified_using
44        external_reference = [] if external_reference is None else external_reference
45        external_identifier = [] if external_identifier is None else external_identifier
46        namespaces = [] if namespaces is None else namespaces
47        imports = [] if imports is None else imports
48        check_types_and_set_values(self, locals())