2323"""Inputs."""
2424
2525from textwrap import wrap
26+ import warnings
2627import weakref
2728
29+ from typing_extensions import deprecated
30+
2831from ansys .dpf import core
2932from ansys .dpf .core .mapping_types import map_types_to_python
3033from ansys .dpf .core .outputs import Output , _Outputs
@@ -112,7 +115,7 @@ def connect(self, inpt):
112115 self ._python_expected_types , inpt , self ._pin , corresponding_pins
113116 )
114117 if len (corresponding_pins ) > 1 :
115- err_str = "Pin connection is ambiguous, specify the pin with:\n "
118+ err_str = "Pin connection is ambiguous, specify the input to connect to with:\n "
116119 for pin in corresponding_pins :
117120 err_str += (
118121 " - operator.inputs."
@@ -121,7 +124,9 @@ def connect(self, inpt):
121124 + inpt ._dict_outputs [pin [1 ]].name
122125 + ")"
123126 )
124- raise ValueError (err_str )
127+ err_str += "Connecting to first input in the list.\n "
128+ warnings .warn (message = err_str )
129+ corresponding_pins = [corresponding_pins [0 ]]
125130
126131 if len (corresponding_pins ) == 0 :
127132 err_str = (
@@ -213,11 +218,15 @@ def __str__(self):
213218 docstr += "{:<5}{:<4}{:<20}\n " .format (* line )
214219 return docstr
215220
221+ @deprecated ("Use explicit output-to-input connections." )
216222 def connect (self , inpt ):
217223 """Connect any input (an entity or an operator output) to any input pin of this operator.
218224
219225 Searches for the input type corresponding to the output.
220226
227+ .. deprecated::
228+ Deprecated in favor of explicit output-to-input connections.
229+
221230 Parameters
222231 ----------
223232 inpt : str, int, double, bool, list[int], list[float], Field, FieldsContainer, Scoping,
@@ -250,12 +259,14 @@ def connect(self, inpt):
250259 corresponding_pins ,
251260 )
252261 if len (corresponding_pins ) > 1 :
253- err_str = "Pin connection is ambiguous, specify the pin with:\n "
262+ err_str = "Pin connection is ambiguous, specify the input to connect to with:\n "
254263 for pin in corresponding_pins :
255264 if isinstance (pin , tuple ):
256265 pin = pin [0 ]
257266 err_str += " - operator.inputs." + self ._dict_inputs [pin ].name + "(input)\n "
258- raise ValueError (err_str )
267+ err_str += "Connecting to first input in the list.\n "
268+ warnings .warn (message = err_str )
269+ corresponding_pins = [corresponding_pins [0 ]]
259270
260271 if len (corresponding_pins ) == 0 :
261272 err_str = "The input should have one of the expected types:\n "
0 commit comments