def soft_convert_objects(values, datetime=True, numeric=True, timedelta=True,<EOL>coerce=False, copy=True):
conversion_count = sum((datetime, numeric, timedelta))<EOL>if conversion_count == <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>elif conversion_count > <NUM_LIT:1> and coerce:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>if isinstance(values, (list, tuple)):<EOL><INDENT>values = np.array(values, dtype=np.object_)<EOL><DEDENT>elif not hasattr(values, '<STR_LIT>'):<EOL><INDENT>values = np.array([values], dtype=np.object_)<EOL><DEDENT>elif not is_object_dtype(values.dtype):<EOL><INDENT>values = values.copy() if copy else values<EOL>return values<EOL><DEDENT>if coerce:<EOL><INDENT>if datetime:<EOL><INDENT>from pandas import to_datetime<EOL>return to_datetime(values, errors='<STR_LIT>').to_numpy()<EOL><DEDENT>elif timedelta:<EOL><INDENT>from pandas import to_timedelta<EOL>return to_timedelta(values, errors='<STR_LIT>').to_numpy()<EOL><DEDENT>elif numeric:<EOL><INDENT>from pandas import to_numeric<EOL>return to_numeric(values, errors='<STR_LIT>')<EOL><DEDENT><DEDENT>if datetime:<EOL><INDENT>try:<EOL><INDENT>values = lib.maybe_convert_objects(values,<EOL>convert_datetime=datetime)<EOL><DEDENT>except OutOfBoundsDatetime:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if timedelta and is_object_dtype(values.dtype):<EOL><INDENT>values = lib.maybe_convert_objects(values, convert_timedelta=timedelta)<EOL><DEDENT>if numeric and is_object_dtype(values.dtype):<EOL><INDENT>try:<EOL><INDENT>converted = lib.maybe_convert_numeric(values, set(),<EOL>coerce_numeric=True)<EOL>values = converted if not isna(converted).all() else values<EOL>values = values.copy() if copy else values<EOL><DEDENT>except Exception:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return values<EOL>
if we have an object dtype, try to coerce dates and/or numbers