Skip to content

Commit

Permalink
feat: model.cast to allow empty dicts
Browse files Browse the repository at this point in the history
  • Loading branch information
minenwerfer committed Aug 26, 2023
1 parent 519e05a commit acae19b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/micromodel/micromodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit acae19b

Please sign in to comment.