class_docstr: User defined function in Python
  
  .. versionadded:: 1.3
  
  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","..","versionadded",":",":","1.3","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 inspect import getfullargspec
  import functools
  import inspect
  import sys
  import warnings
  from typing import Callable, Any, TYPE_CHECKING, Optional, cast, Union
  from py4j.java_gateway import JavaObject
  from pyspark import SparkContext
  from pyspark.rdd import _prepare_for_python_RDD, PythonEvalType
  from pyspark.sql.column import Column, _to_java_expr, _to_seq
  from pyspark.sql.types import DataType, StringType, StructType, _parse_datatype_string
  from pyspark.sql.utils import get_active_spark_context
  from pyspark.sql.pandas.types import to_arrow_type
  from pyspark.sql.pandas.utils import require_minimum_pandas_version, require_minimum_pyarrow_version
  from pyspark.errors import PySparkTypeError, PySparkNotImplementedError, PySparkRuntimeError
label_desc: Use image node_id 6 for calling the UserDefinedFunction obj's underlying member method code with example usage: obj._wrapped() and returns: wrapper, self