Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dacite/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ def from_dict(data_class: Type[T], data: Data, config: Optional[Config] = None)
def _build_value(type_: Type, data: Any, config: Config) -> Any:
if is_init_var(type_):
type_ = extract_init_var(type_)
if type_ in config.type_hooks:
data = config.type_hooks[type_](data)
if not is_union(type_):
for th_type, func in config.type_hooks.items():
if is_subclass(th_type, type_):
data = func(data)
if is_optional(type_) and data is None:
return data
if is_union(type_):
Expand Down