File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -326,8 +326,14 @@ def libE_specs(self, new_specs):
326326 return
327327
328328 # Cast new libE_specs temporarily to dict
329- if not isinstance (new_specs , dict ):
330- new_specs = specs_dump (new_specs , by_alias = True , exclude_none = True , exclude_defaults = True )
329+ if not isinstance (new_specs , dict ): # exclude_defaults should only be enabled with Pydantic v2
330+ platform_specs_set = False
331+ if new_specs .platform_specs != {}: # bugginess across Pydantic versions for recursively casting to dict
332+ platform_specs_set = True
333+ platform_specs = new_specs .platform_specs
334+ new_specs = specs_dump (new_specs , exclude_none = True , exclude_defaults = True )
335+ if platform_specs_set :
336+ new_specs ["platform_specs" ] = specs_dump (platform_specs , exclude_none = True )
331337
332338 # Unset "comms" if we already have a libE_specs that contains that field, that came from parse_args
333339 if new_specs .get ("comms" ) and hasattr (self ._libE_specs , "comms" ) and self .parsed :
You can’t perform that action at this time.
0 commit comments