
    (phQ                     j    S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	   " S S5      r
 " S	 S
\
5      rg)zb
inspectors.py   # Per-endpoint view introspection

See schemas.__init__.py for package overview.
    N)WeakKeyDictionary)	smart_str)api_settings)
formattingc                       \ rS rSrSr\R                  " S5      rS rS r	S r
\S 5       r\R                  S 5       r\R                  S	 5       rS
 rS rSrg)ViewInspector   zO
Descriptor class on APIView.

Provide subclass for per-view schema generation
z^[a-zA-Z][0-9A-Za-z_]*:c                 "    [        5       U l        g N)r   instance_schemasselfs    T/var/www/html/venv/lib/python3.13/site-packages/rest_framework/schemas/inspectors.py__init__ViewInspector.__init__   s     1 3    c                 N    XR                   ;   a  U R                   U   $ Xl        U $ )a  
Enables `ViewInspector` as a Python _Descriptor_.

This is how `view.schema` knows about `view`.

`__get__` is called when the descriptor is accessed on the owner.
(That will be when view.schema is called in our case.)

`owner` is always the owner class. (An APIView, or subclass for us.)
`instance` is the view instance or `None` if accessed from the class,
rather than an instance.

See: https://docs.python.org/3/howto/descriptor.html for info on
descriptor usage.
r   view)r   instanceowners      r   __get__ViewInspector.__get__   s+      ,,,((22	r   c                 4    X R                   U'   Ub  Xl        g g r   r   )r   r   others      r   __set__ViewInspector.__set__2   s     */h'!J r   c                 B    U R                   c   S5       eU R                   $ )zView property.zvSchema generation REQUIRES a view instance. (Hint: you accessed `schema` from the view class rather than an instance.)_viewr   s    r   r   ViewInspector.view7   s-     zz% 	
E	
% zzr   c                     Xl         g r   r   )r   values     r   r   r!   @   s    
r   c                     S U l         g r   r   r   s    r   r   r!   D   s	    
r   c           	      x   U R                   n[        USUR                  5       5      n[        X4S5      R                  nU(       a=  U R	                  X2R                  5       [
        R                  " [        U5      5      5      $ U R	                  U[        USUR                  5       5      UR                  5       5      $ )zw
Determine a path description.

This will be based on the method docstring if one exists,
or else the class docstring.
actionN)	r   getattrlower__doc___get_description_sectionr   dedentr   get_view_description)r   pathmethodr   method_namemethod_docstrings         r   get_descriptionViewInspector.get_descriptionH   s     yydHflln="4d;CC00||~zGXGXYbcsYtGuvv00wtXv||~7^151J1J1LN Nr   c                    UR                  5       nSnSS0nU HZ  nU R                  R                  U5      (       a(  UR                  S5      u  pXn	U	R	                  5       Xe'   MK  Xe==   SU-   -  ss'   M\     [
        R                  n
X&;   a  Xb   R	                  5       $ X*;   a  X   U;   a  XjU      R	                  5       $ US   R	                  5       $ )N :
)
splitlinesheader_regexmatch	partitionstripr   SCHEMA_COERCE_METHOD_NAMES)r   r   headerdescriptionlinescurrent_sectionsectionsline	separatorleadcoerce_method_namess              r   r*   &ViewInspector._get_description_sectionZ   s    &&(8D  &&t,,37>>#3F0D,0JJL))TD[8)  +EE#))++("*h6F ;<BBDD|!!##r   )r    r   r   N)__name__
__module____qualname____firstlineno__r)   recompiler8   r   r   r   propertyr   setterdeleterr1   r*   __static_attributes__ r   r   r   r      sv     ::78L4,"
   
[[  
\\ N$$r   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )DefaultSchemap   z?Allows overriding AutoSchema using DEFAULT_SCHEMA_CLASS settingc                    > [         TU ]  X5      n[        U[        5      (       d  U$ [        R
                  n[        U[        5      (       d   S5       eU" 5       nXl        U$ )NzTDEFAULT_SCHEMA_CLASS must be set to a ViewInspector (usually an AutoSchema) subclass)	superr   
isinstancerS   r   DEFAULT_SCHEMA_CLASS
issubclassr   r   )r   r   r   resultinspector_class	inspector	__class__s         r   r   DefaultSchema.__get__r   s`    1&-00M&;;/=99 	
b	
9 $%	!r   rQ   )rG   rH   rI   rJ   r)   r   rP   __classcell__)r]   s   @r   rS   rS   p   s    I r   rS   )r)   rK   weakrefr   django.utils.encodingr   rest_framework.settingsr   rest_framework.utilsr   r   rS   rQ   r   r   <module>rd      s4   
 
 % + 0 +^$ ^$BM r   