
    h8                         S SK r S SKrS SKrS SKJr   " S S5      r " S S5      r " S S5      rS	 rS
 r	S r
S rS r\" 5       rS r " S S5      rS r " S S\5      rS rg)    N)wrapsc                   B    \ rS rSrSrSr\S 5       rS rS r	S	S jr
Srg)
cached_property   z
Decorator that converts a method with a single self argument into a
property cached on the instance.

A cached property can be made out of an existing method:
(e.g. ``url = cached_property(get_absolute_url)``).
Nc                     [        S5      e)NzICannot use cached_property instance without calling __set_name__() on it.	TypeError)instances    I/var/www/html/env/lib/python3.13/site-packages/django/utils/functional.pyfunccached_property.func   s    $
 	
    c                 2    Xl         [        US5      U l        g )N__doc__)	real_funcgetattrr   selfr   s     r   __init__cached_property.__init__   s    tY/r   c                     U R                   c  X l         U R                  U l        g X R                   :w  a  [        SU R                   < SU< S35      eg )Nz?Cannot assign the same cached_property to two different names (z and z).)namer   r   r	   )r   ownerr   s      r   __set_name__cached_property.__set_name__   sF    99IDIYY"&))T3  r   c                 b    Uc  U $ U R                  U5      =o1R                  U R                  '   U$ )z
Call the function and put the return value in instance.__dict__ so that
subsequent attribute access on the instance returns the cached value
instead of calling cached_property.__get__().
)r   __dict__r   )r   r
   clsress       r   __get__cached_property.__get__'   s4     K-1YYx-@@		*
r   )r   r   r   r   N)__name__
__module____qualname____firstlineno__r   r   staticmethodr   r   r   r    __static_attributes__ r   r   r   r      s/     D
 
0	r   r   c                   2    \ rS rSrSrSS jrSS jrS rSrg)	classproperty3   z{
Decorator that converts a method with a single cls argument into a property
that can be accessed directly from the class.
Nc                     Xl         g r"   fgetr   methods     r   r   classproperty.__init__9   s    	r   c                 $    U R                  U5      $ r"   r.   )r   r
   r   s      r   r    classproperty.__get__<   s    yy~r   c                     Xl         U $ r"   r.   r0   s     r   getterclassproperty.getter?   s    	r   r.   r"   )	r#   r$   r%   r&   r   r   r    r6   r(   r)   r   r   r+   r+   3   s    
r   r+   c                       \ rS rSrSrSrg)PromiseD   zv
Base class for the proxy class created in the closure of the lazy function.
It's used to recognize promises in code.
r)   N)r#   r$   r%   r&   r   r(   r)   r   r   r9   r9   D   s    
 	r   r9   c                   ^ ^^  " U U4S jS[         5      mT HV  nUR                  5        H?  nUR                   H,  n[        TU5      (       a  M  US.U 4S jjn[	        TXE5        M.     MA     MX     [        T 5      U4S j5       nU$ )z
Turn any callable into a lazy evaluated callable. result classes or types
is required -- at least one is needed so that the automatic forcing of
the lazy evaluation code is triggered. Results are not memoized; the
function is evaluated on every access.
c                      > \ rS rSrSrS rU U4S jrS rU 4S jrS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rSrg)lazy.<locals>.__proxy__U   z
Encapsulate a function call and act as a proxy for methods that are
called on the result of that function. The function is not evaluated
until one of the methods on the result is called.
c                     Xl         X l        g r"   _args_kw)r   argskws      r   r    lazy.<locals>.__proxy__.__init__\   s    JHr   c                 H   > [         TU R                  U R                  4T-   4$ r"   )_lazy_proxy_unpicklerA   rB   )r   r   resultclassess    r   
__reduce__"lazy.<locals>.__proxy__.__reduce__`   s'    $tzz488,}< r   c                      X[        U 5      '   U $ r"   )id)r   memos     r   __deepcopy__$lazy.<locals>.__proxy__.__deepcopy__f   s     "DNKr   c                 <   > T" U R                   0 U R                  D6$ r"   r@   r   s    r   __castlazy.<locals>.__proxy__.__castm   s    0txx00r   c                 4    [        U R                  5       5      $ r"   )repr_proxy____castr   s    r   __repr__ lazy.<locals>.__proxy__.__repr__s       &&r   c                 4    [        U R                  5       5      $ r"   )strrU   rV   s    r   __str__lazy.<locals>.__proxy__.__str__v   s    t{{}%%r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:H  $ r"   
isinstancer9   rU   r   others     r   __eq__lazy.<locals>.__proxy__.__eq__y   +    %));;=E))r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:g  $ r"   r_   ra   s     r   __ne__lazy.<locals>.__proxy__.__ne__~   re   r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:  $ r"   r_   ra   s     r   __lt__lazy.<locals>.__proxy__.__lt__   +    %));;=5((r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:*  $ r"   r_   ra   s     r   __le__lazy.<locals>.__proxy__.__le__   re   r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:  $ r"   r_   ra   s     r   __gt__lazy.<locals>.__proxy__.__gt__   rl   r   c                 r    [        U[        5      (       a  UR                  5       nU R                  5       U:  $ r"   r_   ra   s     r   __ge__lazy.<locals>.__proxy__.__ge__   re   r   c                 4    [        U R                  5       5      $ r"   )hashrU   rV   s    r   __hash__ lazy.<locals>.__proxy__.__hash__   rY   r   c                 6    [        U R                  5       U5      $ r"   )formatrU   )r   format_specs     r   
__format__"lazy.<locals>.__proxy__.__format__   s    $++-55r   c                 (    U R                  5       U-   $ r"   rU   ra   s     r   __add__lazy.<locals>.__proxy__.__add__       ;;=5((r   c                 &    XR                  5       -   $ r"   r   ra   s     r   __radd__ lazy.<locals>.__proxy__.__radd__   s    ;;=((r   c                 (    U R                  5       U-  $ r"   r   ra   s     r   __mod__lazy.<locals>.__proxy__.__mod__   r   r   c                 (    U R                  5       U-  $ r"   r   ra   s     r   __mul__lazy.<locals>.__proxy__.__mul__   r   r   r@   N)r#   r$   r%   r&   r   r   rI   rN   rU   rW   r\   rc   rg   rj   rn   rq   rt   rx   r}   r   r   r   r   r(   )r   rH   s   r   	__proxy__r=   U   sb    					1	'	&	*
	*
	)
	*
	)
	*
	'	6	)	)	)	)r   r   )__method_namec                ^   > T" U R                   0 U R                  D6n[        XA5      " U0 UD6$ r"   )rA   rB   r   )r   r   rC   rD   resultr   s        r   __wrapper__lazy.<locals>.__wrapper__   s1     "4::::F"694F2FFr   c                     > T" X5      $ r"   r)   )rC   rD   r   s     r   r   r      s     ""r   )r9   mror   hasattrsetattrr   )r   rH   resultclasstype_method_namer   r   s   ``    @r   lazyr   M   s    U) U)G U)r % __&E$~~ 9k22 <G G G 	;<  . ' %$ 4[# # r   c                 &    [        U /UQ76 " U0 UD6$ r"   )r   )r   rC   kwargsrH   s       r   rG   rG      s    %}%t6v66r   c                 6    [        [        [        5      " U 5      $ )zC
Shortcut for the common case of a lazy callable that returns str.
)r   r[   )texts    r   lazystrr      s     S>$r   c                  8   ^  T (       d  [        S5      eU 4S jnU$ )z
A decorator that allows a function to be called with one or more lazy
arguments. If none of the args are lazy, the function is evaluated
immediately, otherwise a __proxy__ is returned that will evaluate the
function when needed.
z3You must pass at least one argument to keep_lazy().c                 N   >^ ^ [        T /TQ76 m[        T 5      U U4S j5       nU$ )Nc                     > [        S [        R                  " XR                  5       5       5       5      (       a  T" U 0 UD6$ T" U 0 UD6$ )Nc              3   B   #    U  H  n[        U[        5      v   M     g 7fr"   )r`   r9   ).0args     r   	<genexpr>@keep_lazy.<locals>.decorator.<locals>.wrapper.<locals>.<genexpr>   s!      AC 3((As   )any	itertoolschainvalues)rC   r   r   	lazy_funcs     r   wrapper-keep_lazy.<locals>.decorator.<locals>.wrapper   sN     $??4A   !$1&11(((r   )r   r   )r   r   r   rH   s   ` @r   	decoratorkeep_lazy.<locals>.decorator   s/    ..		t	) 
	) r   r   )rH   r   s   ` r   	keep_lazyr      s!     MNN r   c                 ,    [        [        5      " U 5      $ )zG
A decorator for functions that accept lazy arguments and return text.
)r   r[   )r   s    r   keep_lazy_textr      s     S>$r   c                 "   ^  U 4S jnSUl         U$ )Nc                 x   > U R                   =n[        L a  U R                  5         U R                   nT" U/UQ76 $ r"   )_wrappedempty_setup)r   rC   r   r   s      r   innernew_method_proxy.<locals>.inner   s6    %H%/KKM}}HH$t$$r   F)_mask_wrapped)r   r   s   ` r   new_method_proxyr      s    %  ELr   c                   6  ^  \ rS rSrSrSrS rU 4S jr\" \	5      r
S rS rS rS	 rS
 rS r\" \5      r\" \5      r\" \5      r\" \5      r\" \" \R6                  " S5      5      5      r\" \R:                  5      r\" \R>                  5      r \" \RB                  5      r"\" \RF                  5      r$\" \%5      r&\" \RN                  5      r(\" \RR                  5      r*\" \RV                  5      r,\" \-5      r.\" \/5      r0\" \Rb                  5      r2Sr3U =r4$ )
LazyObjecti  z
A wrapper for another class that can be used to delay instantiation of the
wrapped class.

By subclassing, you have the opportunity to intercept and alter the
instantiation. If you don't need to do that, use SimpleLazyObject.
Nc                     [         U l        g r"   )r   r   rV   s    r   r   LazyObject.__init__  s     r   c                    > US:X  a  [         TU ]  U5      $ [         TU ]  U5      n[        USS5      (       d  [        eU$ )Nr   r   T)super__getattribute__r   AttributeError)r   r   value	__class__s      r   r   LazyObject.__getattribute__  sF    :7+D11(. uot44  r   c                     US:X  a  X R                   S'   g U R                  [        L a  U R                  5         [	        U R                  X5        g )Nr   )r   r   r   r   r   )r   r   r   s      r   __setattr__LazyObject.__setattr__!  s9    :(-MM*%}}%DMM4/r   c                     US:X  a  [        S5      eU R                  [        L a  U R                  5         [	        U R                  U5        g )Nr   zcan't delete _wrapped.)r	   r   r   r   delattr)r   r   s     r   __delattr__LazyObject.__delattr__*  s9    :455==E!KKMt$r   c                     [        S5      e)zE
Must be implemented by subclasses to initialize the wrapped object.
z7subclasses of LazyObject must provide a _setup() method)NotImplementedErrorrV   s    r   r   LazyObject._setup1  s     "E
 	
r   c                 n    U R                   [        L a  U R                  5         [        U R                   44$ r"   )r   r   r   unpickle_lazyobjectrV   s    r   rI   LazyObject.__reduce__G  s)    ==E!KKM#dmm%566r   c                     U R                   [        L a  [        U 5      " 5       $ [        R                  " U R                   5      $ r"   )r   r   typecopyrV   s    r   __copy__LazyObject.__copy__L  s1    ==E! :< 99T]]++r   c                     U R                   [        L a  [        U 5      " 5       nX![        U 5      '   U$ [        R
                  " U R                   U5      $ r"   )r   r   r   rL   r   deepcopyr   rM   r   s      r   rN   LazyObject.__deepcopy__U  s@    ==E! $Z\F#DNM}}T]]D11r   r   r   )5r#   r$   r%   r&   r   r   r   r   r   r   __getattr__r   r   r   rI   r   rN   bytes	__bytes__r[   r\   bool__bool__dir__dir__propertyoperator
attrgetterr   eqrc   ltrj   gtrq   nerg   rw   rx   getitem__getitem__setitem__setitem__delitem__delitem__iter__iter__len__len__contains__contains__r(   __classcell__r   s   @r   r   r     s$    H
	 #7+K0%
,7
,2 !'Is#G%H s#G )(*=*=k*JKLIhkk*Fhkk*Fhkk*Fhkk*F%H #8#3#34K"8#3#34K"8#3#34K%Hs#G#H$5$56Lr   r   c                     U $ )z\
Used to unpickle lazy objects. Just return its argument, which will be the
wrapped object.
r)   )wrappeds    r   r   r   w  s	    
 Nr   c                   x   ^  \ rS rSrSrU 4S jrS rS rS rS r	\
" \R                  5      r\
S 5       rS	rU =r$ )
SimpleLazyObjecti  z
A lazy object initialized from any function.

Designed for compound objects of unknown type. For builtins or objects of
known type, use django.utils.functional.lazy.
c                 >   > XR                   S'   [        TU ]	  5         g)a  
Pass in a callable that returns the object to be wrapped.

If copies are made of the resulting SimpleLazyObject, which can happen
in various circumstances within Django, then you must ensure that the
callable can be safely run more than once and will return the same
value.

_setupfuncN)r   r   r   )r   r   r   s     r   r   SimpleLazyObject.__init__  s     '+l#r   c                 .    U R                  5       U l        g r"   )r   r   rV   s    r   r   SimpleLazyObject._setup  s    )r   c                     U R                   [        L a  U R                  nOU R                   nS[        U 5      R                  < SU< S3$ )N<z: >)r   r   r   r   r#   )r   	repr_attrs     r   rW   SimpleLazyObject.__repr__  s6    ==E!II!$Z00)<<r   c                     U R                   [        L a  [        U R                  5      $ [        R                  " U R                   5      $ r"   )r   r   r   r   r   rV   s    r   r   SimpleLazyObject.__copy__  s4    ==E! $DOO44 99T]]++r   c                     U R                   [        L a$  [        U R                  5      nX![	        U 5      '   U$ [
        R                  " U R                   U5      $ r"   )r   r   r   r   rL   r   r   r   s      r   rN   SimpleLazyObject.__deepcopy__  sC    ==E! &doo6F#DNM}}T]]D11r   c                 
    X-   $ r"   r)   ra   s     r   r   SimpleLazyObject.__radd__  s
    |r   r   )r#   r$   r%   r&   r   r   r   rW   r   rN   r   r   addr   r   r(   r   r   s   @r   r   r     sC    
*
=,2 x||,G r   r   c                 R    / / 4nU H  nX " U5         R                  U5        M     U$ )z
Split the values into two sets, based on the return value of the function
(True/False). e.g.:

    >>> partition(lambda x: x > 3, range(5))
    [0, 1, 2, 3], [4]
)append)	predicater   resultsitems       r   	partitionr    s3     2hG	$ ''- Nr   )r   r   r   	functoolsr   r   r+   r9   r   rG   r   r   r   objectr   r   r   r   r   r  r)   r   r   <module>r     s}       ) )X "	 	xv7 6  	q7 q7h6z 6rr   