@@ -784,7 +784,7 @@ def load_engine_object(expected_type: Any, v: Any) -> Any:
784784 dc_init_kwargs : dict [str , Any ] = {}
785785 field_types = {f .name : f .type for f in dataclasses .fields (struct_type )}
786786 dataclass_fields = {f .name : f for f in dataclasses .fields (struct_type )}
787-
787+
788788 for name , f_type in field_types .items ():
789789 if name in v :
790790 dc_init_kwargs [name ] = load_engine_object (f_type , v [name ])
@@ -800,7 +800,9 @@ def load_engine_object(expected_type: Any, v: Any) -> Any:
800800 else :
801801 # No explicit default, try to get auto-default
802802 type_info = analyze_type_info (f_type )
803- auto_default , is_supported = _get_auto_default_for_type (type_info )
803+ auto_default , is_supported = _get_auto_default_for_type (
804+ type_info
805+ )
804806 if is_supported :
805807 dc_init_kwargs [name ] = auto_default
806808 # If not supported, skip the field (let dataclass constructor handle the error)
@@ -813,7 +815,7 @@ def load_engine_object(expected_type: Any, v: Any) -> Any:
813815 field_names = list (getattr (struct_type , "_fields" , ()))
814816 field_defaults = getattr (struct_type , "_field_defaults" , {})
815817 nt_init_kwargs : dict [str , Any ] = {}
816-
818+
817819 for name in field_names :
818820 f_type = annotations .get (name , Any )
819821 if name in v :
@@ -826,7 +828,9 @@ def load_engine_object(expected_type: Any, v: Any) -> Any:
826828 else :
827829 # No explicit default, try to get auto-default
828830 type_info = analyze_type_info (f_type )
829- auto_default , is_supported = _get_auto_default_for_type (type_info )
831+ auto_default , is_supported = _get_auto_default_for_type (
832+ type_info
833+ )
830834 if is_supported :
831835 nt_init_kwargs [name ] = auto_default
832836 # If not supported, skip the field (let NamedTuple constructor handle the error)
@@ -844,23 +848,30 @@ def load_engine_object(expected_type: Any, v: Any) -> Any:
844848 field_types = {
845849 name : field .annotation for name , field in model_fields .items ()
846850 }
847-
851+
848852 for name , f_type in field_types .items ():
849853 if name in v :
850854 pydantic_init_kwargs [name ] = load_engine_object (f_type , v [name ])
851855 else :
852856 # Field is missing from input, check if it has a default or can use auto-default
853857 field = model_fields [name ]
854- if hasattr (field , "default" ) and field .default is not ...: # ... is Pydantic's sentinel for no default
858+ if (
859+ hasattr (field , "default" ) and field .default is not ...
860+ ): # ... is Pydantic's sentinel for no default
855861 # Field has an explicit default value
856862 pydantic_init_kwargs [name ] = field .default
857- elif hasattr (field , "default_factory" ) and field .default_factory is not None :
863+ elif (
864+ hasattr (field , "default_factory" )
865+ and field .default_factory is not None
866+ ):
858867 # Field has a default factory
859868 pydantic_init_kwargs [name ] = field .default_factory ()
860869 else :
861870 # No explicit default, try to get auto-default
862871 type_info = analyze_type_info (f_type )
863- auto_default , is_supported = _get_auto_default_for_type (type_info )
872+ auto_default , is_supported = _get_auto_default_for_type (
873+ type_info
874+ )
864875 if is_supported :
865876 pydantic_init_kwargs [name ] = auto_default
866877 # If not supported, skip the field (let Pydantic constructor handle the error)
0 commit comments