1# SPDX-FileCopyrightText: 2023 spdx contributors
2#
3# SPDX-License-Identifier: Apache-2.0
4from abc import abstractmethod
5from dataclasses import field
6
7from beartype.typing import List
8
9from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
10from spdx_tools.spdx3.model import Element, ExternalMap, NamespaceMap
11
12
13@dataclass_with_properties
14class ElementCollection(Element):
15 # due to the inheritance we need to make all fields non-default in the __annotation__,
16 # the __init__ method still raises an error if required fields are not set
17 element: List[str] = field(default_factory=list)
18 root_element: List[str] = field(default_factory=list)
19 namespaces: List[NamespaceMap] = field(default_factory=list)
20 imports: List[ExternalMap] = field(default_factory=list)
21
22 @abstractmethod
23 def __init__(self):
24 pass