
    (ph*#              
          S r SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJrJrJr  SSKJr  SS	KJr  S
 rS r " S S5      r " S S\\R,                  5      r " S S\\R0                  5      r " S S\R4                  \R6                  \5      r " S S\R:                  \R4                  \R<                  \R>                  \R6                  \5      r g)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                 \    [        U S5      =(       a    [        U R                  [        5      $ )Nmapping)hasattr
isinstancer   r   )attrs    J/var/www/html/venv/lib/python3.13/site-packages/rest_framework/viewsets.py_is_extra_actionr      s    4#N
4<<(NN    c                 N    U R                   U:X  d   SR                  XS95       eU $ )NzExpected 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   #   s7    ==D  F	( *0T)E	F 
 Kr   c                   \   ^  \ rS rSrSr\S	S j5       rU 4S jrS r\	S 5       r
S rSrU =r$ )
ViewSetMixin,   aH  
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                   ^ ^^ ST l         ST l        ST l        ST l        ST l        T(       d  [        S5      eT H^  nUT R                  ;   a  [        SU< ST R                  < S35      e[        T U5      (       a  MD  [        T R                  < SU< 35      e   ST;   a  ST;   a  [        S	T R                  -  5      eUU U4S
 jn[        UT SS9  [        UT R                  SS9  T Ul        TUl        TUl        [        U5      $ )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                    > T" S0 T	D6nST;   a  ST;  a  TS   TS'   TUl         TR                  5        H  u  pE[        X55      n[        X4U5        M     Xl        Xl        X#l        UR                  " U /UQ70 UD6$ )Ngethead )
action_mapitemsgetattrsetattrrequestargskwargsdispatch)
r)   r*   r+   selfmethodactionhandleractionscls
initkwargss
          r   view"ViewSetMixin.as_view.<locals>.viewf   s    $$DF'$9")%.
 &DO #*--/!$/g. #2 #LI K ==:4:6::r   r$   )updated)assigned)r   descriptionr    detailbasename	TypeErrorhttp_method_namesr   r   r   r,   r2   r3   r1   r   )r2   r1   r3   keyr4   s   ```  r   as_viewViewSetMixin.as_view9   s    
 
 
   : ; ;
 Cc+++#&!6 7 7 3$$LL#!' ( (  ZH
$: <?B||M N N	;2 	tS"- 	tS\\B7
 $4  r   c                    > [         TU ]  " U/UQ70 UD6nUR                  R                  5       nUS:X  a	  SU l        U$ U R
                  R                  U5      U l        U$ )zK
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   rD   ViewSetMixin.initialize_request   se     ',WFtFvF%%'Y %DK  //--f5DKr   c                 8   U R                   < SU< 3nSnU R                  (       a;  U R                  R                  (       a   U R                  R                  R                  nU(       a  US-   U-   nUR	                  SU R                  5        [        U/UQ70 UD6$ )z.
Reverse the action for the given `url_name`.
-N:r)   )r:   r)   resolver_match	namespace
setdefaultr   )r-   url_namer*   r+   rL   s        r   reverse_actionViewSetMixin.reverse_action   sy     #mmX6	<<DLL7733==I 31H)T\\2x1$1&11r   c                 j    [        U [        5       VVs/ s H  u  p[        X!5      PM     snn$ s  snnf )z@
Get the methods that are marked as an extra ViewSet `@action`.
)r   r   r   )r2   r   r.   s      r   get_extra_actionsViewSetMixin.get_extra_actions   s;     c#3464 !D !.46 	6 6s   /c                 (   0 nU R                   c  U$ U R                  5        Vs/ s H!  nUR                   U R                   :X  d  M  UPM#     nnU H  n U R                  < SUR                  < 3nU R                  R
                  R                  nU(       a	  U< SU< 3n[        X@R                  U R                  U R                  S9nU R                  " S0 UR                  D6nXaUR                  5       '   M     U$ s  snf ! [         a     M  f = f)z~
Build a map of {names: urls} for the extra actions.

This method will noop if `detail` was not provided as a view initkwarg.
rI   rJ   )r)   r$   )r9   rR   r:   rN   r)   rK   rL   r   r*   r+   rF   get_view_namer   )r-   action_urlsr/   r1   rN   rL   urlr4   s           r   get_extra_action_url_map%ViewSetMixin.get_extra_action_url_map   s      ;; "&!7!7!9
!9v}}+ !9 	 

 F
&*mmV__E LL77AA	*3X>Hh		4;;U~~6647D..01  %
 " s   C>C>B$D
DD)r/   r%   r*   r+   r)   )N)r   
__module____qualname____firstlineno____doc__r   r>   rD   rO   classmethodrR   rX   __static_attributes____classcell__)rF   s   @r   r   r   ,   sG    
 Q! Q!f2 6 6 r   r   c                       \ rS rSrSrSrg)ViewSet   zA
The base ViewSet class does not provide any actions by default.
r$   Nr   rZ   r[   r\   r]   r_   r$   r   r   rb   rb      s     	r   rb   c                       \ rS rSrSrSrg)GenericViewSet   z
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.
r$   Nrd   r$   r   r   rf   rf      s    
 	r   rf   c                       \ rS rSrSrSrg)ReadOnlyModelViewSet   zD
A viewset that provides default `list()` and `retrieve()` actions.
r$   Nrd   r$   r   r   ri   ri      s     	r   ri   c                       \ rS rSrSrSrg)ModelViewSet   z}
A viewset that provides default `create()`, `retrieve()`, `update()`,
`partial_update()`, `destroy()` and `list()` actions.
r$   Nrd   r$   r   r   rl   rl      s     	r   rl   N)!r]   	functoolsr   inspectr   django.urlsr   django.utils.decoratorsr   django.views.decorators.csrfr   rest_frameworkr   r	   r
   rest_framework.decoratorsr   rest_framework.reverser   r   r   r   APIViewrb   GenericAPIViewrf   RetrieveModelMixinListModelMixinri   CreateModelMixinUpdateModelMixinDestroyModelMixinrl   r$   r   r   <module>r}      s   $ %  & 3 4 2 2 2 *Of fR	lEMM 		\8#:#: 		644!00)	
	6**,,**++((!
	r   