
    BVh                     b    d Z ddlZddlmZ ddlmZ ddlmZ d Zd Zd Z	d	 Z
d
 Zd Zdad Zy)z"Utility to retrieve function args.    N)
config_pb2)tf_decorator)
tf_inspectc                 |    t        j                  |       \  }} t        j                  |       xr | j                  d uS )N)r   unwrapr   ismethod__self__)fn_s     U/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/util/function_utils.py_is_bound_methodr      s5    


b
!%!R			R	 	>bkk&=>    c                 \    t        | d      xr t        j                  | j                        S )N__call__)hasattrr   r   r   )objs    r   _is_callable_objectr      s#    	j	!	Gj&9&9#,,&GGr   c                    t        | t        j                        rXt        | j                        }|t        | j                        d D cg c]  }|| j                  xs g vs| }}t        |      S t        |       r| j                  } t        j                  |       j                  }t        |       r|r|j                  d       t        |      S c c}w )a  Get argument names for function-like object.

  Args:
    fn: Function, or function-like object (e.g., result of `functools.partial`).

  Returns:
    `tuple` of string argument names.

  Raises:
    ValueError: if partial function has positionally bound arguments
  Nr   )
isinstance	functoolspartialfn_argsfunclenargskeywordsr   r   r   getfullargspecr   poptuple)r
   r   as      r   r   r   !   s     I%%&277DCLM*K!a8Ir.JAKDK 
t 2;;b$$R(--D hhqk	t Ls   
C"Cc                    t        | t        j                        r| j                  } n>t	        |       r| j
                  } n&t        |       st        d|  dt        |        d      t        j                  |       j                  duS )a-  Returns whether the passed callable has **kwargs in its signature.

  Args:
    fn: Function, or function-like object (e.g., result of `functools.partial`).

  Returns:
    `bool`: if `fn` has **kwargs in its signature.

  Raises:
     `TypeError`: If fn is not a Function, or function-like object.
  z1Argument `fn` should be a callable. Received: fn=
 (of type )N)r   r   r   r   r   r   callable	TypeErrortyper   r   varkw)r
   s    r   
has_kwargsr(   <   s{     I%%&	B2	BB<
	t:d2hZq	23 3 
	"	"2	&	,	,D	88r   c                    t        j                  |       \  }} t        |       rt        j                  |       r| j
                  S t        j                  |       r9| j                  j                  j
                  d| j                  j
                  S t        t        |             S t        d|  dt        |        d      )z Returns name of passed callable..2Argument `func` must be a callable. Received func=r"   r#   )r   r   r$   r   
isfunction__name__r   r	   	__class____func__strr&   
ValueErrorr   r   s     r   get_func_namer3   S   s    %'!Td^T"]]			T	"
--
!
!
*
*
--
 
  
 d_
	jdA	78 8r   c                 6   t        j                  |       \  }} t        |       rMt        j                  |       st        j
                  |       r| j                  S 	 | j                  j                  S t        d|  dt        |        d      # t        $ r Y yw xY w)z?Returns func_code of passed callable, or None if not available.Nr+   r"   r#   )r   r   r$   r   r,   r   __code__r   AttributeErrorr1   r&   r2   s     r   get_func_coder7   f   s    %'!Td^T"j&9&9$&?]]
]]### 	jdA	78 8  s   B 	BBc                      t         At        j                         } | j                  j                  }d|_        | j                         a t         S )NT)#_rewriter_config_optimizer_disabledr   ConfigProtograph_optionsrewrite_optionsdisable_meta_optimizerSerializeToString)configrewriter_configs     r   get_disabled_rewriter_configrA   }   sD    (0##%F**::O-1O**0*B*B*D'	,,r   )__doc__r   tensorflow.core.protobufr   tensorflow.python.utilr   r   r   r   r   r(   r3   r7   r9   rA    r   r   <module>rF      sB    )  / / -?
H69.8&8( '+ #-r   