@@ -152,49 +152,6 @@ def _make_hashable(obj):
152152
153153 return hash (_make_hashable (self .to_dict ()))
154154
155- @classmethod
156- def _from_dict (cls , d : Optional [dict ]) -> Optional ["NodeSource" ]:
157- """
158- Recursively deserialize from_node metadata from dictionary data.
159- It is used to deserialize the from_node field from serialized metadata.
160- Please use contructor NodeSource(node, ...) to create a NodeSource object.
161- """
162- if d is None :
163- return None
164-
165- assert isinstance (d , dict ), f"Expected a dict, got { type (d )} "
166-
167- # Create a NodeSource object directly without going through the constructor
168- # to avoid issues with graph ID and node creation
169- node_source = NodeSource .__new__ (NodeSource )
170-
171- # Set the basic attributes
172- node_source .pass_name = d .get ("pass_name" , "" )
173-
174- # Parse action string back to NodeSourceAction enum list
175- action_str = d .get ("action" , "" )
176- actions = []
177- if action_str :
178- for action_name in action_str .split ("+" ):
179- if action_name .upper () == "CREATE" :
180- actions .append (NodeSourceAction .CREATE )
181- elif action_name .upper () == "REPLACE" :
182- actions .append (NodeSourceAction .REPLACE )
183- node_source .action = actions
184-
185- # Create the NodeInfo object directly
186- if "name" in d and "target" in d and "graph_id" in d :
187- node_info = NodeSource .NodeInfo (
188- d .get ("name" , "" ), d .get ("target" , "" ), d .get ("graph_id" , - 1 )
189- )
190- node_source .node_info = node_info
191- else :
192- node_source .node_info = None
193-
194- # Recursively deserialize nested from_node
195- node_source .from_node = [cls ._from_dict (fn ) for fn in d .get ("from_node" , [])]
196- return node_source
197-
198155
199156@compatibility (is_backward_compatible = False )
200157@contextmanager
0 commit comments