From acae19b958c06064a83a542ab842f9a28ec6355f Mon Sep 17 00:00:00 2001 From: ringeringeraja Date: Sat, 26 Aug 2023 01:30:20 -0300 Subject: [PATCH] feat: model.cast to allow empty dicts --- src/micromodel/micromodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/micromodel/micromodel.py b/src/micromodel/micromodel.py index fe59539..c75efe5 100644 --- a/src/micromodel/micromodel.py +++ b/src/micromodel/micromodel.py @@ -13,7 +13,7 @@ def __init__(self, model_type: typing.Callable[[typing.Any], T], ct: dict[str, t self.model_type = model_type self.ct = ct - def cast(self, target: T): return target + def cast(self, target: T | dict[typing.Never, typing.Never]): return typing.cast(T, target) def validate(self, target: T, options: ValidationOptions = {}): return validate(self.model_type, typing.cast(typing.Any, target), options, self.ct) def raise_missing_key(k: int | str):