Ë
    ûûàg*#  ã            
       ó®  — d 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
 ddlmZmZmZ ddlmZ dd	lmZ d
„ Zd„ Z G d„ d«      Z G d„ deej,                  «      Z G d„ deej0                  «      Z G d„ dej4                  ej6                  e«      Z G d„ dej:                  ej4                  ej<                  ej>                  ej6                  e«      Z y)a�  
ViewSets are essentially just a type of class based view, that doesn't provide
any method handlers, such as `get()`, `post()`, etc... but instead has actions,
such as `list()`, `retrieve()`, `create()`, etc...

Actions are only bound to methods at the point of instantiating the views.

    user_list = UserViewSet.as_view({'get': 'list'})
    user_detail = UserViewSet.as_view({'get': 'retrieve'})

Typically, rather than instantiate views from viewsets directly, you'll
register the viewset with a router and let the URL conf be determined
automatically.

    router = DefaultRouter()
    router.register(r'users', UserViewSet, 'user')
    urlpatterns = router.urls
é    )Úupdate_wrapper)Ú
getmembers)ÚNoReverseMatch)Úclassonlymethod)Úcsrf_exempt)ÚgenericsÚmixinsÚviews)ÚMethodMapper)Úreversec                 óR   — t        | d«      xr t        | j                  t        «      S )NÚmapping)ÚhasattrÚ
isinstancer   r   )Úattrs    úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/rest_framework/viewsets.pyÚ_is_extra_actionr      s   € Ü�4˜Ó#ÒN¬
°4·<±<ÄÓ(NÐNó    c                 óT   — | j                   |k(  sJ dj                  | |¬«      «       ‚| S )NzãExpected function (`{func.__name__}`) to match its attribute name (`{name}`). If using a decorator, ensure the inner function is decorated with `functools.wraps`, or that `{func.__name__}.__name__` is otherwise set to `{name}`.©ÚfuncÚname)Ú__name__Úformatr   s     r   Ú_check_attr_namer   #   s9   € Ø�=‰=˜DÒ ð Fð	(÷ *0©°TÀ¨Ó)Eó	FÐ ð
 €Kr   c                   óP   ‡ — e Zd ZdZedd„«       Zˆ fd„Zd„ Zed„ «       Z	d„ Z
ˆ xZS )ÚViewSetMixinad  
    This is the magic.

    Overrides `.as_view()` so that it takes an `actions` keyword that performs
    the binding of HTTP methods to actions on the Resource.

    For example, to create a concrete view binding the 'GET' and 'POST' methods
    to the 'list' and 'create' actions...

    view = MyViewSet.as_view({'get': 'list', 'post': 'create'})
    c                 óð  ‡ ‡‡— d‰ _         d‰ _        d‰ _        d‰ _        d‰ _        ‰st        d«      ‚‰D ]R  }|‰ j                  v rt        d|›d‰ j                  ›d�«      ‚t        ‰ |«      rŒ:t        ‰ j                  ›d|›�«      ‚ d‰v rd‰v rt        d	‰ j                  z  «      ‚ˆˆ ˆfd
„}t        |‰ d¬«       t        |‰ j                  d¬«       ‰ |_        ‰|_        ‰|_        t        |«      S )zä
        Because of the way class based views create a closure around the
        instantiated view, we need to totally reimplement `.as_view`,
        and slightly modify the view function that is created and returned.
        NzwThe `actions` argument must be provided when calling `.as_view()` on a ViewSet. For example `.as_view({'get': 'list'})`zYou tried to pass in the z& method name as a keyword argument to z(). Don't do that.z() received an invalid keyword r   ÚsuffixzO%s() received both `name` and `suffix`, which are mutually exclusive arguments.c                 óú   •—  ‰di ‰	¤Ž}d‰v rd‰vr‰d   ‰d<   ‰|_         ‰j                  «       D ]  \  }}t        ||«      }t        |||«       Œ  | |_        ||_        ||_         |j                  | g|¢­i |¤ŽS )NÚgetÚhead© )Ú
action_mapÚitemsÚgetattrÚsetattrÚrequestÚargsÚkwargsÚdispatch)
r(   r)   r*   ÚselfÚmethodÚactionÚhandlerÚactionsÚclsÚ
initkwargss
          €€€r   Úviewz"ViewSetMixin.as_view.<locals>.viewf   sœ   ø€ ÙÑ$˜Ñ$ˆDà˜Ñ F°'Ñ$9Ø")¨%¡.�˜‘ð
 &ˆDŒOð #*§-¡-£/ò /‘�˜Ü! $¨Ó/�Ü˜˜f gÕ.ð/ð #ˆDŒLØˆDŒIØ ˆDŒKð !�4—=‘= Ð:¨4Ò:°6Ñ:Ð:r   r#   )Úupdated)Úassigned)r   Údescriptionr   ÚdetailÚbasenameÚ	TypeErrorÚhttp_method_namesr   r   r   r+   r1   r2   r0   r   )r1   r0   r2   Úkeyr3   s   ```  r   Úas_viewzViewSetMixin.as_view9   s  ú€ ð ˆŒØˆŒð
 ˆŒ
ð ˆŒ
ð ˆŒñ Üð :ó ;ð ;ð
 ò 	(ˆCØ�c×+Ñ+Ñ+Ýâ#&¨¯«ð!6ó 7ð 7ô ˜3 Õ$ÜØ—L“L¡#ð!'ó (ð (ð	(ð �ZÑ H°
Ñ$:Üð <Ø?B¿|¹|ñMó Nð Nö	;ô2 	�t˜S¨"Õ-ô 	�t˜SŸ\™\°BÕ7ð
 ˆŒØ$ˆŒØˆŒÜ˜4Ó Ð r   c                 ó¾   •— t        ‰| �  |g|¢­i |¤Ž}|j                  j                  «       }|dk(  r	d| _        |S | j
                  j                  |«      | _        |S )z[
        Set the `.action` attribute on the view, depending on the request method.
        ÚoptionsÚmetadata)ÚsuperÚinitialize_requestr-   Úlowerr.   r$   r!   )r,   r(   r)   r*   r-   Ú	__class__s        €r   rA   zViewSetMixin.initialize_request�   se   ø€ ô ‘'Ñ,¨WÐF°tÒF¸vÑFˆØ—‘×%Ñ%Ó'ˆØ�YÒð %ˆDŒKð ˆð Ÿ/™/×-Ñ-¨fÓ5ˆDŒKØˆr   c                 ó  — | j                   ›d|›�}d}| j                  r6| j                  j                  r | j                  j                  j                  }|r|dz   |z   }|j	                  d| j                  «       t        |g|¢­i |¤ŽS )z>
        Reverse the action for the given `url_name`.
        ú-Nú:r(   )r8   r(   Úresolver_matchÚ	namespaceÚ
setdefaultr   )r,   Úurl_namer)   r*   rH   s        r   Úreverse_actionzViewSetMixin.reverse_actionœ   sy   € ð #Ÿm›m©XÐ6ˆØˆ	Ø�<Š<˜DŸL™L×7Ò7ØŸ™×3Ñ3×=Ñ=ˆIÙØ  3‘¨Ñ1ˆHØ×Ñ˜) T§\¡\Ô2ä�xÐ1 $Ò1¨&Ñ1Ð1r   c                 óh   — t        | t        «      D ��cg c]  \  }}t        ||«      ‘Œ c}}S c c}}w )zP
        Get the methods that are marked as an extra ViewSet `@action`.
        )r   r   r   )r1   r   r-   s      r   Úget_extra_actionszViewSetMixin.get_extra_actionsª   s7   € ô ˜cÔ#3Ó4÷6Ù �D˜&ô ! ¨Õ.ó 6ð 	6ùó 6s   ”.c                 ó
  — i }| j                   €|S | j                  «       D �cg c]  }|j                   | j                   k(  r|‘Œ }}|D ]£  }	 | j                  ›d|j                  ›�}| j                  j
                  j                  }|r|›d|›�}t        || j                  | j                  | j                  ¬«      } | j                  di |j                  ¤Ž}|||j                  «       <   Œ¥ |S c c}w # t        $ r Y Œ¸w xY w)z–
        Build a map of {names: urls} for the extra actions.

        This method will noop if `detail` was not provided as a view initkwarg.
        rE   rF   )r(   r#   )r7   rM   r8   rJ   r(   rG   rH   r   r)   r*   rC   Úget_view_namer   )r,   Úaction_urlsr.   r0   rJ   rH   Úurlr3   s           r   Úget_extra_action_url_mapz%ViewSetMixin.get_extra_action_url_map³   s  € ð ˆð �;‰;ÐØÐð "&×!7Ñ!7Ó!9ö
ØØ�}‰} §¡Ò+ò ð
ˆð 
ð
 ò 	ˆFð
Ø&*§m£m°V·_²_ÐE�Ø ŸL™L×7Ñ7×AÑA�	ÙÚ*3±XÐ>�Hä˜h¨¯	©	°4·;±;ÈÏÉÔU�Ø%�t—~‘~Ñ6¨¯©Ñ6�Ø47�˜D×.Ñ.Ó0Ò1ð	ð Ðùò%
øô "ò Ùðús   £"C1ÁB C6Ã6	DÄD)N)r   Ú
__module__Ú__qualname__Ú__doc__r   r<   rA   rK   ÚclassmethodrM   rR   Ú__classcell__)rC   s   @r   r   r   ,   sB   ø„ ñ
ð òQ!ó ðQ!ôfò2ð ñ6ó ð6ör   r   c                   ó   — e Zd ZdZy)ÚViewSetzI
    The base ViewSet class does not provide any actions by default.
    N©r   rS   rT   rU   r#   r   r   rY   rY   Õ   s   „ ñð 	r   rY   c                   ó   — e Zd ZdZy)ÚGenericViewSetzÀ
    The GenericViewSet class does not provide any actions by default,
    but does include the base set of generic view behavior, such as
    the `get_object` and `get_queryset` methods.
    NrZ   r#   r   r   r\   r\   Ü   s   „ ñð
 	r   r\   c                   ó   — e Zd ZdZy)ÚReadOnlyModelViewSetzL
    A viewset that provides default `list()` and `retrieve()` actions.
    NrZ   r#   r   r   r^   r^   å   s   „ ñð 	r   r^   c                   ó   — e Zd ZdZy)ÚModelViewSetz‰
    A viewset that provides default `create()`, `retrieve()`, `update()`,
    `partial_update()`, `destroy()` and `list()` actions.
    NrZ   r#   r   r   r`   r`   î   s   „ ñð 	r   r`   N)!rU   Ú	functoolsr   Úinspectr   Údjango.urlsr   Údjango.utils.decoratorsr   Údjango.views.decorators.csrfr   Úrest_frameworkr   r	   r
   Úrest_framework.decoratorsr   Úrest_framework.reverser   r   r   r   ÚAPIViewrY   ÚGenericAPIViewr\   ÚRetrieveModelMixinÚListModelMixinr^   ÚCreateModelMixinÚUpdateModelMixinÚDestroyModelMixinr`   r#   r   r   ú<module>rp      s¼   ðñõ$ %Ý å &Ý 3Ý 4ç 2Ñ 2Ý 2Ý *òOò÷fñ fôR	ˆl˜EŸM™Mô 	ô	�\ 8×#:Ñ#:ô 	ô	˜6×4Ñ4Ø!×0Ñ0Ø)ô	ô
	�6×*Ñ*Ø×,Ñ,Ø×*Ñ*Ø×+Ñ+Ø×(Ñ(Ø!õ
	r   