
    (ph                         S SK r S SKrS SKJr  S SKJr   " S S\ R                  R                  5      r " S S\5      r	g)    N)Iterable)cached_propertyc                       \ rS rSrSrSS.S jrS rS rS rS	 r	S
 r
S rS rS rS\4S jrSSS.S\S\4S jjr\S 5       rSrg)Repeated   zA view around a mutable sequence in protocol buffers.

This implements the full Python MutableSequence interface, but all methods
modify the underlying field container directly.
N)
proto_typec                (    Xl         X l        X0l        g)zInitialize a wrapper around a protobuf repeated field.

Args:
    sequence: A protocol buffers repeated field.
    marshal (~.MarshalRegistry): An instantiated marshal, used to
        convert values going to and from this map.
N)_pb_marshal_proto_type)selfsequencemarshalr   s       U/var/www/html/venv/lib/python3.13/site-packages/proto/marshal/collections/repeated.py__init__Repeated.__init__   s     %    c                 P    [        U 5      " U R                  SS U R                  S9$ )z%Copy this object and return the copy.N)r   )typepbr   r   s    r   __copy__Repeated.__copy__)   s    Dz$''!*dmm<<r   c                     U R                   U	 g)zDelete the given item.Nr   r   keys     r   __delitem__Repeated.__delitem__-   s    GGCLr   c                     [        US5      (       a+  [        U R                  5      [        UR                  5      :H  $ [        U[        5      (       a!  [        U R                  5      [        U5      :H  $ S$ )Nr   F)hasattrtupler   
isinstancer   r   others     r   __eq__Repeated.__eq__1   sS    5$>U588_441;E81L1LuTWW~u-WRWWr   c                      U R                   U   $ )zReturn the given item.r   r   s     r   __getitem__Repeated.__getitem__6   s    wws|r   c                 ,    [        U R                  5      $ )z"Return the length of the sequence.)lenr   r   s    r   __len__Repeated.__len__:   s    477|r   c                     X:X  + $ N r$   s     r   __ne__Repeated.__ne__>   s      r   c                     [        / U Q5      $ r0   )reprr   s    r   __repr__Repeated.__repr__A   s    GdG}r   c                      X R                   U'   g r0   r   )r   r   values      r   __setitem__Repeated.__setitem__D   s    r   indexc                 :    U R                   R                  X5        gz2Insert ``value`` in the sequence before ``index``.N)r   insert)r   r<   r9   s      r   r?   Repeated.insertG   s    u$r   Fr   reverser   rB   c                6    U R                   R                  XS9  g)zStable sort *IN PLACE*.rA   N)r   sort)r   r   rB   s      r   rD   Repeated.sortK   s    .r   c                     U R                   $ r0   )r
   r   s    r   r   Repeated.pbO   s    xxr   )r   r
   r   )__name__
__module____qualname____firstlineno____doc__r   r   r   r&   r)   r-   r2   r6   r:   intr?   strboolrD   propertyr   __static_attributes__r1   r   r   r   r      st     9= 
&=X
!%C % "&u /3 / /  r   r   c                   V   ^  \ rS rSrSr\S 5       rU 4S jrS rS r	S\
4S jrS	rU =r$ )
RepeatedCompositeT   zA view around a mutable sequence of messages in protocol buffers.

This implements the full Python MutableSequence interface, but all methods
modify the underlying field container directly.
c                    U R                   b  U R                   $ [        U R                  5      S:  a  [        U R                  S   5      $ [	        U R                  S5      (       aE  [	        U R                  R
                  S5      (       a   U R                  R
                  R                  $ [        R                  " U R                  5      R                  5       n[        U5      $ )z2Return the protocol buffer type for this sequence.r   _message_descriptor_concrete_class)
r   r,   r   r   r!   rV   rW   copydeepcopyadd)r   canarys     r   _pb_typeRepeatedComposite._pb_type[   s    
 '### tww<!
## 477122wGG''):8
 8
 77..>>>
 tww'++-F|r   c                    > [         TU ]  U5      (       a  g[        U[        5      (       a'  [	        U  Vs/ s H  o"PM     sn5      [	        U5      :H  $ S$ s  snf )NTF)superr&   r#   r   r"   )r   r%   i	__class__s      r   r&   RepeatedComposite.__eq__x   sX    7>%   %** d#d1d#$e4	
 	
#s   Ac                 h    U R                   R                  U R                  U R                  U   5      $ r0   )r   	to_pythonr\   r   r   s     r   r)   RepeatedComposite.__getitem__   s%    }}&&t}}dggclCCr   c                    [        U[        5      (       aQ  [        U 5      * Us=::  a  [        U 5      :  a&  O  O#U R                  U5        U R	                  X5        g [        S5      e[        U[        5      (       Ga8  UR                  [        U 5      5      u  p4n[        U[        R                  R                  5      (       d  [        S5      eUS:X  a  [        U5       H4  u  pgX6-   U:  a  U R                  X6-   5        U R	                  X6-   U5        M6     [        XC-
  [        U5      -
  5       H   nU R                  U[        U5      -   5        M"     g [        X4U5      n	[        U5      [        U	5      :w  a#  [        S[        U5       S[        U	5       35      e[        X5       H	  u  pgXpU'   M     g [        S[!        U5      R"                   35      e)Nz"list assignment index out of rangezcan only assign an iterable   z#attempt to assign sequence of size z to extended slice of size z-list indices must be integers or slices, not )r#   rM   r,   popr?   
IndexErrorsliceindicescollectionsabcr   	TypeError	enumeraterange
ValueErrorzipr   rH   )
r   r   r9   startstopstepr<   item_rk   s
             r   r:   RepeatedComposite.__setitem__   s   
 c3D	zS,3t9,C' !EFF U## #CI 6Ee[__%=%=>> =>>qy $-U#3KE}t+/KKt4 $4 t|c%j89AHHUSZ/0 :  T2u:W-$=u:,&Aw<.*  $'w#6KE"&K $7 ?S	@R@R?ST r   r<   c                     U R                   R                  U R                  U5      nU R                  R	                  X5        gr>   )r   to_protor\   r   r?   )r   r<   r9   pb_values       r   r?   RepeatedComposite.insert   s,    ==))$--?u'r   r1   )rH   rI   rJ   rK   rL   r   r\   r&   r)   r:   rM   r?   rQ   __classcell__)ra   s   @r   rS   rS   T   s>      8
D4l(C ( (r   rS   )
rl   rX   typingr   proto.utilsr   rm   MutableSequencer   rS   r1   r   r   <module>r      s8       ';{.. ;|i( i(r   