Skip to content

Commit 14977cd

Browse files
committed
optimized performance of construction
1 parent e474a9a commit 14977cd

File tree

5 files changed

+259
-111
lines changed

5 files changed

+259
-111
lines changed

datamodel/abstract.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from inspect import isclass
77
from dataclasses import dataclass
88
from .parsers.json import JSONContent
9-
from .converters import parse_basic, parse_type
9+
from .converters import encoders, parse_basic, parse_type
1010
from .fields import Field
1111
from .functions import (
1212
is_dataclass,
@@ -178,6 +178,7 @@ def _initialize_fields(attrs, annotations, strict):
178178
df = Field(required=False, type=_type, default=df)
179179
df.name = field
180180
df.type = _type
181+
df._encoder_fn = encoders.get(_type, None)
181182

182183
# Cache reflection info so we DON’T need to call
183184
# get_origin/get_args repeatedly:

0 commit comments

Comments
 (0)