File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,12 @@ def _to_resource_config(self) -> shapes.ResourceConfig:
150
150
compute_config_dict = self .model_dump ()
151
151
resource_config_fields = set (shapes .ResourceConfig .__annotations__ .keys ())
152
152
filtered_dict = {
153
- k : v for k , v in compute_config_dict .items () if k in resource_config_fields
153
+ k : v
154
+ for k , v in compute_config_dict .items ()
155
+ if k in resource_config_fields and v is not None
154
156
}
157
+ if not filtered_dict :
158
+ return None
155
159
return shapes .ResourceConfig (** filtered_dict )
156
160
157
161
@@ -193,10 +197,14 @@ def _model_validator(self) -> "Networking":
193
197
def _to_vpc_config (self ) -> shapes .VpcConfig :
194
198
"""Convert to a sagemaker_core.shapes.VpcConfig object."""
195
199
compute_config_dict = self .model_dump ()
196
- resource_config_fields = set (shapes .VpcConfig .__annotations__ .keys ())
200
+ vpc_config_fields = set (shapes .VpcConfig .__annotations__ .keys ())
197
201
filtered_dict = {
198
- k : v for k , v in compute_config_dict .items () if k in resource_config_fields
202
+ k : v
203
+ for k , v in compute_config_dict .items ()
204
+ if k in vpc_config_fields and v is not None
199
205
}
206
+ if not filtered_dict :
207
+ return None
200
208
return shapes .VpcConfig (** filtered_dict )
201
209
202
210
You can’t perform that action at this time.
0 commit comments