Skip to content

Commit f261701

Browse files
committed
Make vo expensive property cached
1 parent 89e0cc4 commit f261701

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • src/app/domain/value_objects

src/app/domain/value_objects/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import Field, dataclass, fields
2+
from functools import cached_property
23
from typing import Any, ClassVar, Final, get_args, get_origin
34

45
from app.domain.exceptions.base import DomainFieldError
@@ -36,7 +37,7 @@ def __check_field_existence(self) -> None:
3637
f"{type(self).__name__} must have at least one field!",
3738
)
3839

39-
@property
40+
@cached_property
4041
def __instance_fields(self) -> tuple[Field[Any], ...]:
4142
"""
4243
Return only instance fields, exclude `Final[ClassVar[T]]`.

0 commit comments

Comments
 (0)