o
    i                     @   s   d dl Z d dlZd dlZd dlmZ d dlmZ er,d dlZe Z	e j
ejejjdZe jdddd Zd	d
 ZeejjejjejjhZdd Zdd Zdd Zdd Zdd Zdd Zedd Zdd ZdS )    N)contextmanager)PY314annotation_formati   )maxsizec                 C   s&   t t| j }|r|dd  }|S )N   )tuple	signature
parametersvalues)funcremove_firstr
    r   T/var/www/html/formularioweb/env/lib/python3.10/site-packages/django/utils/inspect.py_get_func_parameters   s   r   c                 C   s$   t | }|r
| jn| }t||dS )N)r   )inspectismethod__func__r   )meth_or_func	is_methodr   r   r   r   _get_callable_parameters   s   
r   c                 C   s   t | }dd |D S )Nc                 S   s   g | ]
}|j tv r|jqS r   )kind	ARG_KINDSname.0paramr   r   r   
<listcomp>+   s    z!get_func_args.<locals>.<listcomp>)r   )r   paramsr   r   r   get_func_args)   s   r   c                 C   s   t | }g }|D ]7}|j}|dkrq|jtjjkrd| }n|jtjjkr)d| }|jtjjkr9|	||jf q|	|f q|S )z
    Return a list of (argument name, default value) tuples. If the argument
    does not have a default value, omit it in the tuple. Arguments such as
    *args and **kwargs are also included.
    self*z**)
r   r   r   r   	ParameterVAR_POSITIONALVAR_KEYWORDdefaultemptyappend)r   r   argsr   r   r   r   r   get_func_full_args.   s   
r)   c                 C      t dd t| D S )zBReturn True if function 'func' accepts keyword arguments **kwargs.c                 s        | ]}|j |jkr|V  qd S N)r   r$   r   pr   r   r   	<genexpr>H       z&func_accepts_kwargs.<locals>.<genexpr>anyr   r   r   r   r   func_accepts_kwargsF   s   r4   c                 C   r*   )zL
    Return True if function 'func' accepts positional arguments *args.
    c                 s   r+   r,   )r   r#   r-   r   r   r   r/   O   r0   z(func_accepts_var_args.<locals>.<genexpr>r1   r3   r   r   r   func_accepts_var_argsK   s   r5   c                 C   s0   t dd t| D }t| r|dkS |dkS )z,Return True if a method only accepts 'self'.c                 S   s   g | ]	}|j tv r|qS r   )r   r   r-   r   r   r   r   T   s    z&method_has_no_args.<locals>.<listcomp>r   r   )lenr   r   r   )methcountr   r   r   method_has_no_argsR   s   r9   c                    s   t  fddt| D S )Nc                 3   s    | ]}|j  kV  qd S r,   r   r   r:   r   r   r/   Y   s    z*func_supports_parameter.<locals>.<genexpr>r1   )r   r   r   r:   r   func_supports_parameterX   s   r;   c               	   c   s`    t sdV  dS t tj} tt_zdV  W | t_n| t_w W d   dS 1 s)w   Y  dS )a  
    inspect.getfullargspec eagerly evaluates type annotations. To add
    compatibility with Python 3.14+ deferred evaluation, patch the module-level
    helper to provide the annotation_format that we are using elsewhere.

    This private helper could be removed when there is an upstream solution for
    https://github.com/python/cpython/issues/141560.

    This context manager is not reentrant.
    N)r   lockr   _signature_from_callablesafe_signature_from_callable)original_helperr   r   r   lazy_annotations\   s   "r@   c                 C   s    t rtj| tjjdS t| S )z
    A wrapper around inspect.signature that leaves deferred annotations
    unevaluated on Python 3.14+, since they are not used in our case.
    r   )r   r   r	   annotationlibFormat
FORWARDREF)objr   r   r   r	   t   s   
r	   ) 	functoolsr   	threading
contextlibr   django.utils.versionr   rA   Lockr<   partialr=   rB   rC   r>   	lru_cacher   r   	frozensetr"   POSITIONAL_ONLYKEYWORD_ONLYPOSITIONAL_OR_KEYWORDr   r   r)   r4   r5   r9   r;   r@   r	   r   r   r   r   <module>   s<    

	
