We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1973ce1 commit fc96cf2Copy full SHA for fc96cf2
src/spdx_tools/common/typing/dataclass_with_properties.py
@@ -1,12 +1,14 @@
1
# SPDX-FileCopyrightText: 2022 spdx contributors
2
#
3
# SPDX-License-Identifier: Apache-2.0
4
-from dataclasses import dataclass
+from dataclasses import dataclass, field
5
+from typing import dataclass_transform
6
7
from beartype import beartype
8
from beartype.roar import BeartypeCallHintException
9
10
11
+@dataclass_transform(field_specifiers=(field,))
12
def dataclass_with_properties(cls):
13
"""Decorator to generate a dataclass with properties out of the class' value:type list.
14
Their getters and setters will be subjected to the @typechecked decorator to ensure type conformity."""
0 commit comments