
    >|h                     `    d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  G d	 d
      Zy)zArguments parsing    N)abc)deepcopy)wraps)FlaskParser   )
deepupdatec                   :    e Zd ZdZ e       ZddddddddZd Zy)ArgumentsMixinz1Extend Blueprint to add arguments parsing featurejsonNT)locationcontent_typerequireddescriptionexampleexamplesc                    
 |d||d<   ||d<   ||d<   ||d<   j                  d j                  j                        

 fd}	|	S )a$  Decorator specifying the schema used to deserialize parameters

        :param type|Schema schema: Marshmallow ``Schema`` class or instance
            used to deserialize and validate the argument.
        :param str location: Location of the argument.
        :param str content_type: Content type of the argument.
            Should only be used in conjunction with ``json``, ``form`` or
            ``files`` location.
            The default value depends on the location and is set in
            ``Blueprint.DEFAULT_LOCATION_CONTENT_TYPE_MAPPING``.
            This is only used for documentation purpose.
        :param bool required: Whether argument is required (default: True).
        :param str description: Argument description.
        :param dict example: Parameter example.
        :param dict examples: Parameter examples.
        :param kwargs: Keyword arguments passed to the webargs
            :meth:`use_args <webargs.core.Parser.use_args>` decorator used
            internally.

        The `required` and `description` only affect `body` arguments
        (OpenAPI 2) or `requestBody` (OpenAPI 3), because the docs expose the
        whole schema. For other locations, the schema is turned into an array
        of parameters and the required/description value of each parameter item
        is taken from the corresponding field in the schema.

        The `example` and `examples` parameters are mutually exclusive and
        should only be used with OpenAPI 3 and when location is ``json``.

        See :doc:`Arguments <arguments>`.
        )inr   schemar   r   r   r   error_status_codec                     t                fd       }t        t        |di             |_        |j                  j	                  di       }|j	                  dg       j                         t        j                        j                  |j	                  di       <     j                  j                  fdi|      S )Nc                       | i |S )N )f_argsf_kwargsfuncs     V/var/www/html/test/engine/venv/lib/python3.12/site-packages/flask_smorest/arguments.pywrapperz<ArgumentsMixin.arguments.<locals>.decorator.<locals>.wrapperQ   s    V0x00    _apidoc	arguments
parameters	responsesr   )r   r   getattrr   
setdefaultappendhttp
HTTPStatusnameARGUMENTS_PARSERuse_args)	r   r   docsr   kwargsr   r!   r   selfs	   `  r   	decoratorz+ArgumentsMixin.arguments.<locals>.decoratorP   s    4[1 1
 'ww	2'FGGO??--k2>DOOL"-44Z@BF//!Cd OOK,->?
 W14((11&V8VvV r   )getr)   DEFAULT_VALIDATION_STATUS)r-   r   r   r   r   r   r   r   r,   r.   r   r!   s   ```     ` @@r   r    zArgumentsMixin.arguments   s    Z  


 #)5J~&$+Jy!%-Jz""(3J}%"JJ!6!6!P!P
	 	& r   c                   |j                  d      }|rJ|d   D cg c]  }t        |t        j                        s|! }}|j                  j
                  dk  rV|D ]P  }	|	d   | j                  v s|	j                  dd       xs | j                  |	d      }
|
|j                  k7  r|
g|d<    n n|D ]  }	|	d   | j                  v sdD ci c]  }||	v r||	|    }}dD ci c]  }||	v r||	j                  |       }}|	j                  dd       xs | j                  |	d      }
|
|i|d	<   ||d
<   |d   j                  |	       |d   s|d=  n t        ||      }|S c c}w c c}w c c}w )Nr    r!      r   r   consumes)r   r   )r   r   r   contentrequestBody)r/   
isinstancer   Mappingopenapi_versionmajor%DEFAULT_LOCATION_CONTENT_TYPE_MAPPINGpop!DEFAULT_REQUEST_BODY_CONTENT_TYPEremover   )r-   docdoc_infoapispecr,   	operationpr!   paramr   xrequest_bodyfieldss                 r   _prepare_arguments_docz%ArgumentsMixin._prepare_arguments_doce   s    LL-	$\2jCKK6PJ  ##))A-' ET{t'Q'QR!IInd; W#II%PT+V % (3+P+PP ,5Ij1  ( ET{t'Q'QR &A( ! Ez uQxK( ( &G" ! Ez uyy|O" " "IInd; W#II%PT+V % 4@2HY/3?	-0!,/66u=(6 ), 7-. S),C
W*(
"s   E!E!E&#E+)__name__
__module____qualname____doc__r   r)   r    rH   r   r   r   r
   r
      s-    ;"} Qf0r   r
   )rL   r&   collectionsr   copyr   	functoolsr   webargs.flaskparserr   utilsr   r
   r   r   r   <module>rR      s&         + H Hr   