
    <%iu              )       N   d dl Z d dlZd dlmZmZmZmZmZmZm	Z	m
Z
mZ d dlmZ ej                  dk\  r	d dlmZmZ nd dlmZmZ d dlmZmZ d dlmZmZ d dlmZ d d	lmZmZmZmZmZ d d
l m!Z!m"Z" eee	e   f   Z#eee	e   f   Z$eee	e   f   Z%ed   Z&ee'ef   Z(ee'ef   Z)ed   Z* G d de      Z+ G d d      Z, G d de,      Z- G d de,      Z. G d de,      Z/ G d de,      Z0 e
dedef         Z1 G d de,      Z2 G d de,      Z3ddeeddddddddddddddfd ee'   d!eeee.e$f         d"ed#ed$eee'      d%ee(   d&ee(   d'ee4   d(eee'      d)ee4   d*ee4   d+ee)   d,eee'      d-eee'      d.eee-      d/eee'ef      d0eee2      d1eeee'e'f   e'f      d2ee1ge1f   f&d3Z5	 d?d4ee$e%e!e)e"f   d5ee'   d2ee1ge1f   fd6Z6	 	 	 	 	 	 	 d@d7ee4   d8eee'      d9eee'      d.eee-      d/eee'ef      d5ee'   d%ee(   d2ee1ge1f   fd:Z7d2ee1ge1f   fd;Z8d<e'd=ee'ef   d2efd>Z9y)A    N)	AnyCallableDictOptionalSequenceTupleTypeTypeVarUnion)Promise)      )FinalLiteral)Fieldempty)ListSerializer
Serializer)api_settings)errorget_view_method_namesisolate_view_methodset_overridewarn)OpenApiTypes_KnownPythonTypes)querypathheadercookie)requestresponsec                        e Zd ZdZ	 ddedeee   eeef   e	g ee   f   e	g eeef   f   f   de
e   de
e   f fdZ fdZed        Zej                   d	        Zed
        Zd Zd Zd Z xZS )PolymorphicProxySerializera  
    This class is to be used with :func:`@extend_schema <.extend_schema>` to
    signal a request/response might be polymorphic (accepts/returns data
    possibly from different serializers). Usage usually looks like this:

    .. code-block::

        @extend_schema(
            request=PolymorphicProxySerializer(
                component_name='MetaPerson',
                serializers=[
                    LegalPersonSerializer, NaturalPersonSerializer,
                ],
                resource_type_field_name='person_type',
            )
        )
        def create(self, request, *args, **kwargs):
            return Response(...)

    **Beware** that this is not a real serializer and it will raise an AssertionError
    if used in that way. It **cannot** be used in views as ``serializer_class``
    or as field in an actual serializer. It is solely meant for annotation purposes.

    Also make sure that each sub-serializer has a field named after the value of
    ``resource_type_field_name`` (discriminator field). Generated clients will likely
    depend on the existence of this field.

    Setting ``resource_type_field_name`` to ``None`` will remove the discriminator
    altogether. This may be useful in certain situations, but will most likely break
    client generation. Another use-case is explicit control over sub-serializer's ``many``
    attribute. To explicitly control this aspect, you need disable the discriminator with
    ``resource_type_field_name=None`` as well as disable automatic list handling with
    ``many=False``.

    It is **strongly** recommended to pass the ``Serializers`` as **list**,
    and by that let *drf-spectacular* retrieve the field and handle the mapping
    automatically. In special circumstances, the field may not available when
    *drf-spectacular* processes the serializer. In those cases you can explicitly state
    the mapping with ``{'legal': LegalPersonSerializer, ...}``, but it is then your
    responsibility to have a valid mapping.

    It is also permissible to provide a callable with no parameters for ``serializers``,
    such as a lambda that will return an appropriate list or dict when evaluated.
    component_nameserializersresource_type_field_namemanyc                     || _         || _        || _        | j                  du rt	        | dd       |j                  di       j                  |||d       t        |    di | y )NFr(   contextr%   r&   r'    )	r%   r&   r'   _manyr   
setdefaultupdatesuper__init__)selfr%   r&   r'   r(   kwargs	__class__s         M/usr/local/footviz/venv/lib/python3.12/site-packages/drf_spectacular/utils.pyr1   z#PolymorphicProxySerializer.__init__L   sp     -&(@%::vu-)R(//,&(@1
 	
 	"6"    c                     |j                  dd       }|du rE|j                  di       }dD ]  }||v s|j                  |      ||<     | j                  |i |}nt        |   | g|i |}||_        |S )Nr(   Tr*   r+   )popget	many_initr0   __new__r-   )clsargsr3   r(   r*   arginstancer4   s          r5   r;   z"PolymorphicProxySerializer.__new__f   s    zz&$'4<jjB/GT 3'>")++c"2F3K3 %s}}d5f5Hws<T<V<Hr6   c                 n    t        | j                        r| j                         | _        | j                  S N)callable_serializersr2   s    r5   r&   z&PolymorphicProxySerializer.serializerss   s-    D%%& $ 1 1 3D   r6   c                     || _         y rA   )rC   )r2   values     r5   r&   z&PolymorphicProxySerializer.serializersy   s
    !r6   c                 $    | j                          y rA   _traprD   s    r5   datazPolymorphicProxySerializer.data}   s    

r6   c                 $    | j                          y rA   rH   )r2   rJ   s     r5   to_internal_valuez,PolymorphicProxySerializer.to_internal_value       

r6   c                 $    | j                          y rA   rH   )r2   r?   s     r5   to_representationz,PolymorphicProxySerializer.to_representation   rM   r6   c                     t        d      )NzPolymorphicProxySerializer is an annotation helper and not supposed to be used for real requests. See documentation for correct usage.)AssertionErrorrD   s    r5   rI   z PolymorphicProxySerializer._trap   s    N
 	
r6   rA   )__name__
__module____qualname____doc__strr   r   _SerializerTyper   r   r   boolr1   r;   propertyr&   setterrJ   rL   rO   rI   __classcell__)r4   s   @r5   r$   r$      s    +l $(## )S/)*Xo667T#"67789# '/sm# 4.#4 ! !
 " "  
r6   r$   c                       e Zd Zy)OpenApiSchemaBaseN)rR   rS   rT   r,   r6   r5   r]   r]      s    r6   r]   c                       e Zd ZdZeddddddddf	dedededed	ed
edede	e
eef      de	e   de	eeeef         fdZy)OpenApiExamplea  
    Helper class to document a API parameter / request body / response body
    with a concrete example value.

    It is recommended to provide a singular example value, since pagination
    and list responses are handled by drf-spectacular.

    The example will be attached to the operation object where appropriate,
    i.e. where the given ``media_type``, ``status_code`` and modifiers match.
    Example that do not match any scenario are ignored.

    - media_type will default to 'application/json' unless implicitly specified
      through :class:`.OpenApiResponse`
    - status_codes will default to [200, 201] unless implicitly specified
      through :class:`.OpenApiResponse`
     FNnamerF   external_valuesummarydescriptionrequest_onlyresponse_onlyparameter_only
media_typestatus_codesc                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        y rA   )
ra   rc   rd   rF   rb   re   rf   rg   rh   ri   )r2   ra   rF   rb   rc   rd   re   rf   rg   rh   ri   s              r5   r1   zOpenApiExample.__init__   sP     	&
,(*,$(r6   )rR   rS   rT   rU   r   rV   r   _StrOrPromiserX   r   r   _ParameterLocationTyper   r   intr1   r,   r6   r5   r_   r_      s    & "$%')+!&"'KO(,@D)) )  	)
 #) ') )  ) %U30F+F%GH) !) #8E#s(O#<=)r6   r_   c            (           e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed	<   e
ed
dddd
dddddddd
d
fde
deeeeef   dedededeee      dee
   dedee
   dee   dededee   deee      deee
ef      dedeeeeee
f      f   f"dZy) OpenApiParametera  
    Helper class to document request query/path/header/cookie parameters.
    Can also be used to document response headers.

    Please note that not all arguments apply to all ``location``/``type``/direction
    variations, e.g. path parameters are ``required=True`` by definition.

    For valid ``style`` choices please consult the
    `OpenAPI specification <https://swagger.io/specification/#style-values>`_.
    r   QUERYr   PATHr   HEADERr    COOKIEFr`   NTra   typelocationrequiredrd   enumpattern
deprecatedstyleexplodedefaultallow_blankr(   examples
extensionsexcluder"   c                     || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        || _        || _        |xs g | _        || _        || _        || _        y rA   )ra   rt   ru   rv   rd   rw   rx   ry   rz   r{   r|   r}   r(   r~   r   r   r"   )r2   ra   rt   ru   rv   rd   rw   rx   ry   rz   r{   r|   r}   r(   r~   r   r   r"   s                     r5   r1   zOpenApiParameter.__init__   s    ( 		  &	$
&	 B$ r6   )rR   rS   rT   rU   rp   r   __annotations__rq   rr   rs   rV   r   rW   r   r   _SchemaTyperl   rX   rk   r   r   r   r_   r   rm   r1   r,   r6   r5   ro   ro      sh   	 E5D%FEFE
 Z]/4")+,0%)$#'&* $#';?37!?D%$!$! ):L+UV$! -	$!
 $! '$! 8C=)$! c]$! $! C=$! d^$! $! $! 4.$! x78$!  !c3h0!$!" #$!$ D(5c?";;<%$!r6   ro   c            	       8    e Zd ZdZ	 	 	 ddededeee      fdZ	y)OpenApiResponseam  
    Helper class to bundle a response object (``Serializer``, ``OpenApiType``,
    raw schema, etc) together with a response object description and/or examples.
    Examples can alternatively be provided via :func:`@extend_schema <.extend_schema>`.

    This class is especially helpful for explicitly describing status codes on a
    "Response Object" level.
    Nr"   rd   r~   c                 6    || _         || _        |xs g | _        y rA   )r"   rd   r~   )r2   r"   rd   r~   s       r5   r1   zOpenApiResponse.__init__   s     !& Br6   )Nr`   N)
rR   rS   rT   rU   r   rk   r   r   r_   r1   r,   r6   r5   r   r      s=     !)+;?	'' '' x78	'r6   r   c            
       R    e Zd ZdZ	 	 	 ddedeeeeeef   f      deee	      fdZ
y)OpenApiRequestaf  
    Helper class to combine a request object (``Serializer``, ``OpenApiType``,
    raw schema, etc.) together with an encoding object and/or examples.
    Examples can alternatively be provided via :func:`@extend_schema <.extend_schema>`.

    This class is especially helpful for customizing value encoding for
    ``application/x-www-form-urlencoded`` and ``multipart/*``. The encoding parameter
    takes a dictionary with field names as keys and encoding objects as values.
    Refer to the `specification <https://swagger.io/specification/#encoding-object>`_
    on how to build a valid encoding object.
    Nr!   encodingr~   c                 6    || _         || _        |xs g | _        y rA   )r!   r   r~   )r2   r!   r   r~   s       r5   r1   zOpenApiRequest.__init__  s       Br6   )NNN)rR   rS   rT   rU   r   r   r   rV   r   r_   r1   r,   r6   r5   r   r     sT    
  <@;?	'' tCc3h$789' x78	'r6   r   F.)boundc                   \    e Zd ZdZdededeeegef   e	eeegef   f   e	ee
f   f   fdZy)OpenApiCallbacka  
    Helper class to bundle a callback definition. This specifies a view on the callee's
    side, effectively stating the expectations on the receiving end. Please note that this
    particular :func:`@extend_schema <.extend_schema>` instance operates from the perspective
    of the callback origin, which means that ``request`` specifies the outgoing request.

    For convenience sake, we assume the callback sends ``application/json`` and return a ``200``.
    If that is not sufficient, you can use ``request`` and ``responses`` overloads just as you
    normally would.

    :param name: Name under which the this callback is listed in the schema.
    :param path: Path on which the callback operation is performed. To reference request
        body contents, please refer to OpenAPI specification's
        `key expressions <https://swagger.io/specification/#key-expression>`_ for valid choices.
    :param decorator: :func:`@extend_schema <.extend_schema>` decorator that specifies the receiving
        endpoint. In this special context the allowed parameters are ``requests``, ``responses``,
        ``summary``, ``description``, ``deprecated``.
    ra   r   	decoratorc                 .    || _         || _        || _        y rA   )ra   r   r   )r2   ra   r   r   s       r5   r1   zOpenApiCallback.__init__4  s     		"r6   N)rR   rS   rT   rU   rk   rV   r   r   r   r   r   r1   r,   r6   r5   r   r   !  s_    $## # Xqc1f-tC1#q&9I4I/JDQTVYQYNZ[	#r6   r   c            
       X    e Zd ZdZdedeeegef   ee	eegef   f   ee	e
f   f   fdZy)OpenApiWebhooka  
    Helper class to document webhook definitions. A webhook specifies a possible out-of-band
    request initiated by the API provider and the expected responses from the consumer.

    Please note that this particular :func:`@extend_schema <.extend_schema>` instance operates
    from the perspective of the webhook origin, which means that ``request`` specifies the
    outgoing request.

    For convenience sake, we assume the API provider sends a POST request with a body of type
    ``application/json`` and the receiver responds with ``200`` if the event was successfully
    received.

    :param name: Name under which this webhook is listed in the schema.
    :param decorator: :func:`@extend_schema <.extend_schema>` decorator that specifies the receiving
        endpoint. In this special context the allowed parameters are ``requests``, ``responses``,
        ``summary``, ``description``, ``deprecated``.
    ra   r   c                      || _         || _        y rA   )ra   r   )r2   ra   r   s      r5   r1   zOpenApiWebhook.__init__Q  s    
 	"r6   N)rR   rS   rT   rU   rk   r   r   r   r   rV   r   r1   r,   r6   r5   r   r   ?  sU    "## Xqc1f-tC1#q&9I4I/JDQTVYQYNZ[#r6   r   operation_id
parametersr!   	responsesauthrd   rc   ry   tagsfiltersr   	operationmethodsversionsr~   r   	callbacksexternal_docsreturnc                     	
 D cg c]  }|j                          c}
	 fd}|S c c}w )a3  
    Decorator mainly for the "view" method kind. Partially or completely overrides
    what would be otherwise generated by drf-spectacular.

    :param operation_id: replaces the auto-generated operation_id. make sure there
        are no naming collisions.
    :param parameters: list of additional or replacement parameters added to the
        auto-discovered fields.
    :param responses: replaces the discovered Serializer. Takes a variety of
        inputs that can be used individually or combined

        - ``Serializer`` class
        - ``Serializer`` instance (e.g. ``Serializer(many=True)`` for listings)
        - basic types or instances of ``OpenApiTypes``
        - :class:`.OpenApiResponse` for bundling any of the other choices together with
          either a dedicated response description and/or examples.
        - :class:`.PolymorphicProxySerializer` for signaling that
          the operation may yield data from different serializers depending
          on the circumstances.
        - ``dict`` with status codes as keys and one of the above as values.
          Additionally in this case, it is also possible to provide a raw schema dict
          as value.
        - ``dict`` with tuples (status_code, media_type) as keys and one of the above
          as values. Additionally in this case, it is also possible to provide a raw
          schema dict as value.
    :param request: replaces the discovered ``Serializer``. Takes a variety of inputs

        - ``Serializer`` class/instance
        - basic types or instances of ``OpenApiTypes``
        - :class:`.PolymorphicProxySerializer` for signaling that the operation
          accepts a set of different types of objects.
        - ``dict`` with media_type as keys and one of the above as values. Additionally, in
          this case, it is also possible to provide a raw schema dict as value.
    :param auth: replace discovered auth with explicit list of auth methods
    :param description: replaces discovered doc strings
    :param summary: an optional short summary of the description
    :param deprecated: mark operation as deprecated
    :param tags: override default list of tags
    :param filters: ignore list detection and forcefully enable/disable filter discovery
    :param exclude: set True to exclude operation from schema
    :param operation: manually override what auto-discovery would generate. you must
        provide a OpenAPI3-compliant dictionary that gets directly translated to YAML.
    :param methods: scope extend_schema to specific methods. matches all by default.
    :param versions: scope extend_schema to specific API version. matches all by default.
    :param examples: attach request/response examples to the operation
    :param extensions: specification extensions, e.g. ``x-badges``, ``x-code-samples``, etc.
    :param callbacks: associate callbacks with this endpoint
    :param external_docs: Link external documentation. Provide a dict with an "url" key and
        optionally a "description" key. For convenience, if only a string is given it is
        treated as the URL.
    :return:
    c                    t        | dd       xsY t        | di       j                  dd       xs: t        t        | dd       di       j                  dd       xs t        j                  }t	        j
                  |      s|j                  }fd G 	
fdd|      }t	        j
                  |       rt        d| j                   d| 	       t        | |
      D ]Q  }dt        t        | |      di       vrt        | |      }t        d|j                  d   |fi       |j                  d<   S  |       | _        | S t        |       ret        | d      rYt!        | j"                  dd|i       | j"                  j$                  D ]%  }t!        t        | j"                  |      dd|i       ' | S t        |       r$t        | d      si | _        || j                  d<   | S | S )Nschemar3   r<   c                      | j                   j                  | j                   j                  fi | j                   j                  \  }}d u xs |v }d u xs | j                  v }|xr |S rA   )viewdetermine_versionr!   r3   method)
ext_schemaversion_version_scopemethod_scoper   r   s        r5   is_in_scopez5extend_schema.<locals>.decorator.<locals>.is_in_scope  sv    :::''//((JGQ %,C80CM"d?Jj.?.?7.JL1M1r6   c                        e Zd Z 
fdZ 
fdZ 
fdZ 
fdZ 
fdZ 
fdZ 
fdZ	 
fdZ
 
fd	Z 
fd
Z 
fdZ 
fdZ 
fdZ 	
fdZ 
fdZ 
fdZ xZS )8extend_schema.<locals>.decorator.<locals>.ExtendedSchemac                 l    |j                         | _        
 |       rS t        |   |||||      S rA   )upperr   r0   get_operation)	r2   r   
path_regexpath_prefixr   registryr4   r   r   s	         r5   r   zFextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_operation  s<    $lln([->$$w,T:{FT\]]r6   c                 8    
 |       rS t         |          S rA   )r0   is_excluded)r2   r4   r   r   s    r5   r   zDextend_schema.<locals>.decorator.<locals>.ExtendedSchema.is_excluded  s#    &;t+<"Nw*,,r6   c                 8    r
 |       rS t         |          S rA   )r0   get_operation_id)r2   r4   r   r   s    r5   r   zIextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_operation_id  s!    K$5''w/11r6   c                 V    r |       rt         |          z   S t         |          S rA   )r0   get_override_parameters)r2   r4   r   r   s    r5   r   zPextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_override_parameters  s.    +d"3 7:<zIIw688r6   c                 8    
 |       rS t         |          S rA   )r0   get_auth)r2   r4   r   r   s    r5   r   zAextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_auth  #    #D(9Kw'))r6   c                 V    r |       rt         |          z   S t         |          S rA   )r0   get_examples)r2   r4   r~   r   s    r5   r   zEextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_examples  s.    D 1 7/1H<<w+--r6   c                 D    t         ur
 |       rS t        | 	         S rA   )r   r0   get_request_serializer)r2   r4   r   r!   s    r5   r   zOextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_request_serializer  s%    %'K,="Nw577r6   c                 D    t         ur
 |       rS t        | 	         S rA   )r   r0   get_response_serializers)r2   r4   r   r   s    r5   r   zQextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_response_serializers  s&    E)k$.?$$w799r6   c                 8    r
 |       rS t         |          S rA   )r0   get_description)r2   r4   rd   r   s    r5   r   zHextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_description  s!    ;t#4&&w.00r6   c                 J    r |       rt              S t        | 	         S rA   )rV   r0   get_summary)r2   r4   r   rc   s    r5   r   zDextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_summary  s%    {40w<'w*,,r6   c                 8    r
 |       rS t         |          S rA   )r0   is_deprecated)r2   r4   ry   r   s    r5   r   zFextend_schema.<locals>.decorator.<locals>.ExtendedSchema.is_deprecated  s!    +d"3%%w,..r6   c                 8    
 |       rS t         |          S rA   )r0   get_tags)r2   r4   r   r   s    r5   r   zAextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_tags  r   r6   c                 8    r
 |       rS t         |          S rA   )r0   get_extensions)r2   r4   r   r   s    r5   r   zGextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_extensions  s!    +d"3%%w-//r6   c                 j    # |       rrt        | j                  dg       S g S t        |          S )Nfilter_backends)getattrr   r0   get_filter_backends)r2   r4   r   r   s    r5   r   zLextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_filter_backends  s:    &;t+<HO7499.?DWUWWw244r6   c                 8    
 |       rS t         |          S rA   )r0   get_callbacks)r2   r4   r   r   s    r5   r   zFextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_callbacks  s$    ([->$$w,..r6   c                 8    
 |       rS t         |          S rA   )r0   get_external_docs)r2   r4   r   r   s    r5   r   zJextend_schema.<locals>.decorator.<locals>.ExtendedSchema.get_external_docs  s$     ,T1B((w022r6   )rR   rS   rT   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r[   )r4   r   r   ry   rd   r~   r   r   r   r   r   r   r   r   r!   r   rc   r   s   @r5   ExtendedSchemar     sY    ^-
2
9
*
.
8
:
1
-
/
*
0
5
/
3 3r6   r   z&using @extend_schema on viewset class zV with parameters operation_id or operation will most likely result in a broken schema.delayed)r   r   ExtendedMetaSchema)r   r9   r   DEFAULT_SCHEMA_CLASSinspectisclassr4   r   rR   r   r   rt   r3   r   rB   hasattrsetattrr<   http_method_names)f
BaseSchemar   view_method_nameview_methodr   r   r   r   ry   rd   r~   r   r   r   r   r   r   r   r   r!   r   rc   r   r   s         @r5   r   z extend_schema.<locals>.decorator  s    Ax& 1q(B'++Hd;1 wq%."=AA(DQ	1 00 	 z*#--J	2Q	3 Q	3 Q	3Z Q	3f ??1'9+@<QZZL I\ ] %:q$T  7716F+GSU#VV1!5EF/3(;+=+=h+G*XZ\0""8,	 &'AHHa[WQ. AEE8h%?@%%11 Vv.8^:TUVHa[ 1h' "0AHHXHHr6   )r   )r   r   r!   r   r   rd   rc   ry   r   r   r   r   r   r   r~   r   r   r   r   r   s   ``````````````````  r5   extend_schemar   Z  sE    P 078f6<<>8S S Sj o 9s   Afieldr%   c                       fd}|S )a}  
    Decorator for the "field" kind. Can be used with ``SerializerMethodField`` (annotate the actual
    method) or with custom ``serializers.Field`` implementations.

    If your custom serializer field base class is already the desired type, decoration is not necessary.
    To override the discovered base class type, you can decorate your custom field class.

    Always takes precedence over other mechanisms (e.g. type hints, auto-discovery).

    :param field: accepts a ``Serializer``, :class:`~.types.OpenApiTypes` or raw ``dict``
    :param component_name: signals that the field should be broken out as separate component
    c                 <    t        | d       t        | d       | S )Nr   field_component_namer   )r   r%   r   s    r5   r   z&extend_schema_field.<locals>.decoratorN  s!    Q'Q.?r6   r,   )r   r%   r   s   `` r5   extend_schema_fieldr   =  s    "
 r6   r(   exclude_fieldsdeprecate_fieldsc                 *      fd}|S )a`  
    Decorator for the "serializer" kind. Intended for overriding default serializer behaviour that
    cannot be influenced through :func:`@extend_schema <.extend_schema>`.

    :param many: override how serializer is initialized. Mainly used to coerce the list view detection
        heuristic to acknowledge a non-list serializer.
    :param exclude_fields: fields to ignore while processing the serializer. only affects the
        schema. fields will still be exposed through the API.
    :param deprecate_fields: fields to mark as deprecated while processing the serializer.
    :param examples: define example data to serializer.
    :param extensions: specification extensions, e.g. ``x-is-dynamic``, etc.
    :param component_name: override default class name extraction.
    :param description: override the class docstring for component description
    c                     t        | d       rt        | d       rt        | d       rt        | d       rt        | d       rt        | d       t        | d       | S )Nr(   r   r   r~   r   r%   rd   r   )klassr%   r   rd   r~   r   r   r(   s    r5   r   z+extend_schema_serializer.<locals>.decoratorm  s{    - 0.A 24DE
H5j9 0.A"{;r6   r,   )r(   r   r   r~   r   r%   rd   r   s   ``````` r5   extend_schema_serializerr   V  s    . " r6   c                        fd}|S )a  
    Convenience decorator for the "view" kind. Intended for annotating derived view methods that
    are are not directly present in the view (usually methods like ``list`` or ``retrieve``).
    Spares you from overriding methods like ``list``, only to perform a super call in the body
    so that you have have something to attach :func:`@extend_schema <.extend_schema>` to.

    This decorator also takes care of safely attaching annotations to derived view methods,
    preventing leakage into unrelated views.

    This decorator also supports custom DRF ``@action`` with the method name as the key.

    :param kwargs: method names as argument names and :func:`@extend_schema <.extend_schema>`
      calls as values
    c           
      r   t        |       r)t        | d      r t        di | j                         | S t	        |       }j                         D ]c  \  }}||vr"t        d| d| j                   d| d|        ,t        |d      r|D ]  } |t        | |              R |t        | |             e | S )	Nr<   z@extend_schema_view argument "z" was not found on view z. method override for "z" will be ignored.r   __iter__r,   )	rB   r   extend_schema_viewr<   r   itemsr   rR   r   )r   available_view_methodsmethod_namemethod_decoratorsub_method_decoratorr3   s        r5   r   z%extend_schema_view.<locals>.decorator  s    D>gdE2(((2K!6t!<-3\\^ 	I)K)"884[MAY}}o%<[MI[] 
 
 '4,< Q(()<T;)OPQ !!4T;!GH!	I" r6   r,   )r3   r   s   ` r5   r   r     s    6 r6   ra   fieldsc                 6    t        | t        f|      } |di |S )a  
    A helper function to create an inline serializer. Primary use is with
    :func:`@extend_schema <.extend_schema>`, where one needs an implicit one-off
    serializer that is not reflected in an actual class.

    :param name: name of the
    :param fields: dict with field names as keys and serializer fields as values
    :param kwargs: optional kwargs for serializer initialization
    r,   )rt   r   )ra   r   r3   serializer_classs       r5   inline_serializerr     s#     D:-8%f%%r6   rA   )NNNNNNN):r   systypingr   r   r   r   r   r   r	   r
   r   django.utils.functionalr   version_infor   r   typing_extensionsrest_framework.fieldsr   r   rest_framework.serializersr   r   rest_framework.settingsr   drf_spectacular.drainager   r   r   r   r   drf_spectacular.typesr   r   _ListSerializerTyperW   
_FieldTyperl   rV   rk   r   	Directionr$   r]   r_   ro   r   r   r   r   r   rX   r   r   r   r   r   r,   r6   r5   <module>r     s    
 W W W + v%%0 . A 0  BND,@@A 
D$4455$u+%&
 !DE c7l#38n)*	l
 l
^	 	')& ')T4!( 4!n'' '('& '. CxS)*#' #<#& #8 '+SW(,/3+/%)(,"&"&+/+/,07;/39=>B%`sm`Xe,<o,M&NOP` ` 	`
 x}%` m,` -(` TN` x}%` $` $` K(` (3-(` 8C=)` 8N34`  T#s(^,!`" H_56#`$  d38nc&9 :;%`& qc1f'`J )-_j,M^^_  qc1f4  $26487;/3(,/3(tn( #/( #8C=1( 8N34	(
 T#s(^,( !( m,( qc1f(V*HaS!V$4 *Z&C &c5j)9 &
 &r6   