OwlCyberSecurity - MANAGER
Edit File: _signature.cpython-312.pyc
� h��g� � � � d dl mZ d dlZd dlmZmZmZ d dlmZm Z m Z d dlmZ ddl mZ ddlmZ erd d lmZ dd�Zdd�Z dd �Z d dd�Zy)� )�annotationsN)� Parameter� Signature� signature)� TYPE_CHECKING�Any�Callable)�PydanticUndefined� )� ConfigWrapper)�is_valid_identifier� �� FieldInfoc �^ � dd�} ||j � xs ||j � xs | S )a� Extract the correct name to use for the field when generating a signature. Assuming the field has a valid alias, this will return the alias. Otherwise, it will return the field name. First priority is given to the validation_alias, then the alias, then the field name. Args: field_name: The name of the field field_info: The corresponding FieldInfo object. Returns: The correct name to use when generating a signature. c �@ � t | t � r t | � r| S dS )zBReturn the alias if it is a valid alias and identifier, else None.N)� isinstance�strr )�xs �L/opt/hc_python/lib/python3.12/site-packages/pydantic/_internal/_signature.py�_alias_if_validz2_field_name_for_signature.<locals>._alias_if_valid s � ��q�#�&�+>�q�+A�q�K�t�K� )r r �returnz str | None)�alias�validation_alias)� field_name� field_infor s r �_field_name_for_signaturer s1 � �L� �:�+�+�,�j�� �@[�@[�0\�j�`j�jr c �N � ddl m} | j }t ||� r�| j }|dk( rt }|j }|t u r3|j t u rt j }nt j }| j |t | j |� |�� S | S )z�Modify the signature for a parameter in a dataclass where the default value is a FieldInfo instance. Args: param (Parameter): The parameter Returns: Parameter: The custom processed parameter r r r )� annotation�name�default)�fieldsr r"