class_docstr: User defined function in Python
  
  Notes
  -----
  The constructor of this class is not supposed to be directly called.
  Use :meth:`pyspark.sql.functions.udf` or :meth:`pyspark.sql.functions.pandas_udf`
  to create this instance.
class_docstr_tok: ["User","defined","function","in","Python","Notes","--","--","-","The","constructor","of","this","class","is","not","supposed","to","be","directly","called",".","Use",":","meth",":","`","pyspark.sql.functions.udf","`","or",":","meth",":","`","pyspark.sql.functions.pandas_udf","`","to","create","this","instance","."]
docstr: Wrap this udf with a function and attach docstring from func
docstr_tok: ["Wrap","this","udf","with","a","function","and","attach","docstring","from","func"]
code: def _wrapped(self) -> "UserDefinedFunctionLike":
      """
      Wrap this udf with a function and attach docstring from func
      """
  
      # It is possible for a callable instance without __name__ attribute or/and
      # __module__ attribute to be wrapped here. For example, functools.partial. In this case,
      # we should avoid wrapping the attributes from the wrapped function to the wrapper
      # function. So, we take out these attribute names from the default names to set and
      # then manually assign it after being wrapped.
      assignments = tuple(
          a
          for a in functools.WRAPPER_ASSIGNMENTS
          if a != "__name__" and a != "__module__"
      )
  
      @functools.wraps(self.func, assigned=assignments)
      def wrapper(
          *args: "ColumnOrName", **kwargs: "ColumnOrName"
      ) -> Column:
          return self(*args, **kwargs)
  
      wrapper.__name__ = self._name
      wrapper.__module__ = (
          self.func.__module__
          if hasattr(self.func, "__module__")
          else self.func.__class__.__module__
      )
  
      wrapper.func = self.func  # type: ignore[attr-defined]
      wrapper.returnType = self.returnType  # type: ignore[attr-defined]
      wrapper.evalType = self.evalType  # type: ignore[attr-defined]
      wrapper.deterministic = self.deterministic  # type: ignore[attr-defined]
      wrapper.asNondeterministic = functools.wraps(  # type: ignore[attr-defined]
          self.asNondeterministic
      )(
          lambda: self.asNondeterministic()._wrapped()
      )
      wrapper._unwrapped = self  # type: ignore[attr-defined]
      return wrapper
  
imports: from pyspark.sql.connect.utils import check_dependencies
  import sys
  import functools
  import warnings
  from inspect import getfullargspec
  from typing import cast, Callable, Any, List, TYPE_CHECKING, Optional, Union
  from pyspark.rdd import PythonEvalType
  from pyspark.sql.connect.expressions import ColumnReference, CommonInlineUserDefinedFunction, Expression, NamedArgumentExpression, PythonUDF
  from pyspark.sql.connect.column import Column
  from pyspark.sql.connect.types import UnparsedDataType
  from pyspark.sql.types import DataType, StringType
  from pyspark.sql.udf import UDFRegistration
  from pyspark.errors import PySparkTypeError, PySparkRuntimeError
label_desc: Use image node_id 4 for calling the UserDefinedFunction obj's underlying member method code with example usage: obj._wrapped() and returns: wrapper, self