-
Notifications
You must be signed in to change notification settings - Fork 281
Description
In load_engine_object() - for loading config object from engine side to Python, when we deal with struct-like types, if the field value is not set, and there's no default value on the Python type, we'll get an error. e.g.
@dataclass
class Type1:
x: str
y: Optional[str]
If the value passed from engine doesn't have the y field, our current implementation will call Type1(x='...') which will raise an error as y is missing. But actually it's safe to use None for this case.
We want up update our load_engine_object() to automatically apply the safe default values according to the target type, if a default value isn't provided.
There's an existing _get-auto_default_for_type() method that can be reused to determine if a specific type has a safe default value.
β€οΈ Contributors, please refer to πContributing Guide.
Unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like I'm working on it or Can I work on this issue? to avoid duplicating work. Our Discord server is always open and friendly.