2323"""Inputs."""
2424
2525from textwrap import wrap
26+ import warnings
2627import weakref
2728
2829from ansys .dpf import core
@@ -112,7 +113,7 @@ def connect(self, inpt):
112113 self ._python_expected_types , inpt , self ._pin , corresponding_pins
113114 )
114115 if len (corresponding_pins ) > 1 :
115- err_str = "Pin connection is ambiguous, specify the pin with:\n "
116+ err_str = "Pin connection is ambiguous, specify the input to connect to with:\n "
116117 for pin in corresponding_pins :
117118 err_str += (
118119 " - operator.inputs."
@@ -121,7 +122,9 @@ def connect(self, inpt):
121122 + inpt ._dict_outputs [pin [1 ]].name
122123 + ")"
123124 )
124- raise ValueError (err_str )
125+ err_str += "Connecting to first input in the list.\n "
126+ warnings .warn (message = err_str )
127+ corresponding_pins = [corresponding_pins [0 ]]
125128
126129 if len (corresponding_pins ) == 0 :
127130 err_str = (
@@ -218,13 +221,20 @@ def connect(self, inpt):
218221
219222 Searches for the input type corresponding to the output.
220223
224+ .. deprecated::
225+ Deprecated in favor of explicit output-to-input connections.
226+
221227 Parameters
222228 ----------
223229 inpt : str, int, double, bool, list[int], list[float], Field, FieldsContainer, Scoping,
224230 ScopingsContainer, MeshedRegion, MeshesContainer, DataSources, CyclicSupport, Outputs, os.PathLike # noqa: E501
225231 Input of the operator.
226232
227233 """
234+ warnings .warn (
235+ message = "Use explicit output-to-input connections." , category = DeprecationWarning
236+ )
237+
228238 from pathlib import Path
229239
230240 corresponding_pins = []
@@ -250,12 +260,14 @@ def connect(self, inpt):
250260 corresponding_pins ,
251261 )
252262 if len (corresponding_pins ) > 1 :
253- err_str = "Pin connection is ambiguous, specify the pin with:\n "
263+ err_str = "Pin connection is ambiguous, specify the input to connect to with:\n "
254264 for pin in corresponding_pins :
255265 if isinstance (pin , tuple ):
256266 pin = pin [0 ]
257267 err_str += " - operator.inputs." + self ._dict_inputs [pin ].name + "(input)\n "
258- raise ValueError (err_str )
268+ err_str += "Connecting to first input in the list.\n "
269+ warnings .warn (message = err_str )
270+ corresponding_pins = [corresponding_pins [0 ]]
259271
260272 if len (corresponding_pins ) == 0 :
261273 err_str = "The input should have one of the expected types:\n "
0 commit comments