Release/v0.4.1 #1

Merged
rus07tam merged 12 commits from release/v0.4.1 into main 2025-10-27 15:05:33 +03:00
Showing only changes of commit d640f21107 - Show all commits

View file

@ -36,14 +36,24 @@ class Field[T: Any](ABC, PrivProperty[T]):
@classmethod @classmethod
def custom[R]( def custom[R](
cls: type[Field[Any]], cls: type[Field[Any]],
serialize: Callable[[R], str], serialize: Callable[[Field[R], R], bytes],
deserialize: Callable[[str], R], deserialize: Callable[[Field[R], bytes], R],
) -> type[Field[R]]: ) -> type[Field[R]]:
return inherit( return inherit(
cls, {"serialize": serialize, "deserialize": deserialize} cls, {"serialize": serialize, "deserialize": deserialize}
) )
@final
@staticmethod
def get_fields(class_: type[Any] | Any, /) -> dict[str, Field[Any]]:
if not isinstance(class_, type):
class_ = class_.__class__
return {
k: v for k, v in class_.__dict__.items() if isinstance(v, Field)
}
if TYPE_CHECKING: if TYPE_CHECKING:
@final
@classmethod @classmethod
def type(cls) -> type[T]: ... def type(cls) -> type[T]: ...