spdx_tools.spdx3.model.element

 1# SPDX-FileCopyrightText: 2023 spdx contributors
 2#
 3# SPDX-License-Identifier: Apache-2.0
 4from abc import ABC, abstractmethod
 5from dataclasses import field
 6
 7from beartype.typing import List, Optional
 8
 9from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
10from spdx_tools.spdx3.model import CreationInfo, ExternalIdentifier, ExternalReference, IntegrityMethod
11
12
13@dataclass_with_properties
14class Element(ABC):
15    spdx_id: str  # IRI
16    creation_info: Optional[CreationInfo] = None
17    name: Optional[str] = None
18    summary: Optional[str] = None
19    description: Optional[str] = None
20    comment: Optional[str] = None
21    verified_using: List[IntegrityMethod] = field(default_factory=list)
22    external_reference: List[ExternalReference] = field(default_factory=list)
23    external_identifier: List[ExternalIdentifier] = field(default_factory=list)
24    extension: Optional[str] = None  # placeholder for extension
25
26    @abstractmethod
27    def __init__(self):
28        pass
@dataclass_with_properties
class Element(abc.ABC):
14@dataclass_with_properties
15class Element(ABC):
16    spdx_id: str  # IRI
17    creation_info: Optional[CreationInfo] = None
18    name: Optional[str] = None
19    summary: Optional[str] = None
20    description: Optional[str] = None
21    comment: Optional[str] = None
22    verified_using: List[IntegrityMethod] = field(default_factory=list)
23    external_reference: List[ExternalReference] = field(default_factory=list)
24    external_identifier: List[ExternalIdentifier] = field(default_factory=list)
25    extension: Optional[str] = None  # placeholder for extension
26
27    @abstractmethod
28    def __init__(self):
29        pass
spdx_id: str
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
creation_info: Optional[spdx_tools.spdx3.model.creation_info.CreationInfo]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
name: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
summary: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
description: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
comment: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
external_reference: list[spdx_tools.spdx3.model.external_reference.ExternalReference]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
external_identifier: list[spdx_tools.spdx3.model.external_identifier.ExternalIdentifier]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")
extension: Optional[str]
47    def get_field(self) -> field_type:
48        return getattr(self, f"_{field_name}")