Ë
    ûûàgQ  ã                   ój   — 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	  G d„ d«      Z
 G d	„ d
e
«      Zy)zb
inspectors.py   # Per-endpoint view introspection

See schemas.__init__.py for package overview.
é    N)ÚWeakKeyDictionary)Ú	smart_str)Úapi_settings)Ú
formattingc                   óª   — e Zd ZdZ ej
                  d«      Zd„ Zd„ Zd„ Z	e
d„ «       Zej                  d„ «       Zej                  d„ «       Zd	„ Zd
„ Zy)ÚViewInspectorz[
    Descriptor class on APIView.

    Provide subclass for per-view schema generation
    z^[a-zA-Z][0-9A-Za-z_]*:c                 ó"   — t        «       | _        y ©N)r   Úinstance_schemas©Úselfs    ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/rest_framework/schemas/inspectors.pyÚ__init__zViewInspector.__init__   s   € Ü 1Ó 3ˆÕó    c                 óN   — || j                   v r| j                   |   S || _        | S )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__zViewInspector.__get__   s/   € ð  �t×,Ñ,Ñ,Ø×(Ñ(¨Ñ2Ð2àˆŒ	Øˆr   c                 ó6   — || j                   |<   |�||_        y y r
   r   )r   r   Úothers      r   Ú__set__zViewInspector.__set__2   s$   € Ø*/ˆ×Ñ˜hÑ'ØÐØ!ˆE�Jð r   c                 ó@   — | j                   €J d«       ‚| j                   S )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   zViewInspector.view7   s-   € ð �z‰zÐ%ð 	
ðEó	
Ð%ð �z‰zÐr   c                 ó   — || _         y r
   r   )r   Úvalues     r   r   zViewInspector.view@   s	   € àˆ�
r   c                 ó   — d | _         y r
   r   r   s    r   r   zViewInspector.viewD   s	   € àˆ�
r   c           	      óp  — | j                   }t        |d|j                  «       «      }t        ||d«      j                  }|r=| j	                  ||j                  «       t        j                  t        |«      «      «      S | j	                  |t        |d|j                  «       «      |j                  «       «      S )z—
        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_descriptionzViewInspector.get_descriptionH   sš   € ð �y‰yˆä˜d H¨f¯l©l«nÓ=ˆÜ" 4¨°dÓ;×CÑCÐÙà×0Ñ0°°v·|±|³~Äz×GXÑGXÔYbÐcsÓYtÓGuÓvÐvà×0Ñ0°´w¸tÀXÈvÏ|É|Ë~Ó7^Ø15×1JÑ1JÓ1LóNð Nr   c                 óš  — |j                  «       }d}ddi}|D ]V  }| j                  j                  |«      r)|j                  d«      \  }}}	|	j	                  «       ||<   ŒG||xx   d|z   z  cc<   ŒX t
        j                  }
||v r||   j	                  «       S ||
v r|
|   |v r||
|      j	                  «       S |d   j	                  «       S )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%   z&ViewInspector._get_description_sectionZ   sç   € Ø×&Ñ&Ó(ˆØˆØ˜�8ˆàò 	9ˆDØ× Ñ ×&Ñ& tÔ,Ø37·>±>À#Ó3FÑ0� ¨DØ,0¯J©J«L�˜Ò)à˜Ó)¨T°D©[Ñ8Ô)ð	9ô +×EÑEÐØ�XÑØ˜FÑ#×)Ñ)Ó+Ð+ØÐ(Ñ(Ø" 6Ñ*¨hÑ6ØÐ 3°FÑ ;Ñ<×BÑBÓDÐDØ˜‰|×!Ñ!Ó#Ð#r   N)Ú__name__Ú
__module__Ú__qualname__r$   ÚreÚcompiler2   r   r   r   Úpropertyr   ÚsetterÚdeleterr,   r%   © r   r   r   r      sx   „ ñð �2—:‘:Ð7Ó8€Lò4òò,"ð
 ñó ðð 
‡[�[ñó ðð 
‡\�\ñó ðòNó$$r   r   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚDefaultSchemaz?Allows overriding AutoSchema using DEFAULT_SCHEMA_CLASS settingc                 ó¶   •— t         ‰| �  ||«      }t        |t        «      s|S t        j
                  }t        |t        «      sJ d«       ‚ |«       }||_        |S )NzTDEFAULT_SCHEMA_CLASS must be set to a ViewInspector (usually an AutoSchema) subclass)	Úsuperr   Ú
isinstancerJ   r   ÚDEFAULT_SCHEMA_CLASSÚ
issubclassr   r   )r   r   r   ÚresultÚinspector_classÚ	inspectorÚ	__class__s         €r   r   zDefaultSchema.__get__r   s^   ø€ Ü‘‘ ¨5Ó1ˆÜ˜&¤-Ô0ØˆMä&×;Ñ;ˆÜ˜/¬=Ô9ð 	
Øbó	
Ð9ñ $Ó%ˆ	Ø!ˆ	ŒØÐr   )r@   rA   rB   r$   r   Ú__classcell__)rS   s   @r   rJ   rJ   p   s   ø„ ÙI÷ð r   rJ   )r$   rC   Úweakrefr   Údjango.utils.encodingr   Úrest_framework.settingsr   Úrest_framework.utilsr   r   rJ   rH   r   r   ú<module>rY      s4   ðñó
 
Ý %å +å 0Ý +÷^$ñ ^$ôB�Mõ r   