
    q	h(                     j    S r SSKJr   " S S\5      rS rS rS rS r " S	 S
\5      r	S r
S rS rg)zContains FieldMask class.    )FieldDescriptorc                   R    \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 r SS jrSrg)	FieldMask   z!Class for FieldMask message type. c                     / nU R                    H  nUR                  [        U5      5        M     SR                  U5      $ )z;Converts FieldMask to string according to proto3 JSON spec.,)pathsappend_SnakeCaseToCamelCasejoin)selfcamelcase_pathspaths      U/var/www/html/env/lib/python3.13/site-packages/google/protobuf/internal/field_mask.pyToJsonStringFieldMask.ToJsonString   s8    O

2489 88O$$    c                 
   [        U[        5      (       d  [        SR                  U5      5      eU R	                  5         U(       a=  UR                  S5       H'  nU R                  R                  [        U5      5        M)     gg)z;Converts string to FieldMask according to proto3 JSON spec.z'FieldMask JSON value not a string: {!r}r	   N)	
isinstancestr
ValueErrorformatClearsplitr
   r   _CamelCaseToSnakeCase)r   valuer   s      r   FromJsonStringFieldMask.FromJsonString   sb    eS!!@GGNOOJJL++c"$

/56 # r   c                 N    U R                    H  n[        X5      (       a  M    g   g)z=Checks whether the FieldMask is valid for Message Descriptor.FT)r
   _IsValidPath)r   message_descriptorr   s      r   IsValidForDescriptorFieldMask.IsValidForDescriptor"   s$    

,33  r   c                     U R                  5         UR                   H(  nU R                  R                  UR                  5        M*     g)z:Gets all direct fields of Message Descriptor to FieldMask.N)r   fieldsr
   r   name)r   r"   fields      r   AllFieldsFromDescriptor!FieldMask.AllFieldsFromDescriptor)   s1    JJL#**
jj

# +r   c                 <    [        U5      nUR                  U 5        g)a"  Converts a FieldMask to the canonical form.

Removes paths that are covered by another path. For example,
"foo.bar" is covered by "foo" and will be removed if "foo"
is also in the FieldMask. Then sorts all paths in alphabetical order.

Args:
  mask: The original FieldMask to be converted.
N)_FieldMaskTreeToFieldMask)r   masktrees      r   CanonicalFormFromMaskFieldMask.CanonicalFormFromMask/   s     $DTr   c                     [        U5        [        U5        [        U5      nUR                  U5        UR                  U 5        g)z+Merges mask1 and mask2 into this FieldMask.N)_CheckFieldMaskMessager,   MergeFromFieldMaskr-   )r   mask1mask2r/   s       r   UnionFieldMask.Union<   s8    5!5!% DE"Tr   c                     [        U5        [        U5        [        U5      n[        5       nUR                   H  nUR                  XT5        M     UR	                  U 5        g)z/Intersects mask1 and mask2 into this FieldMask.N)r3   r,   r
   IntersectPathr-   )r   r5   r6   r/   intersectionr   s         r   	IntersectFieldMask.IntersectD   sN    5!5!% D!#L
, T"r   c                 >    [        U 5      nUR                  XX45        g)ad  Merges fields specified in FieldMask from source to destination.

Args:
  source: Source message.
  destination: The destination message to be merged into.
  replace_message_field: Replace message field if True. Merge message
      field if False.
  replace_repeated_field: Replace repeated field if True. Append
      elements of repeated field if False.
N)r,   MergeMessage)r   sourcedestinationreplace_message_fieldreplace_repeated_fieldr/   s         r   r?   FieldMask.MergeMessageN   s#     $D2Lr   N)FF)__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r#   r)   r0   r7   r<   r?   __static_attributes__r   r   r   r   r      s9    ))%7$# ;@Lr   r   c                 B   UR                  S5      nUR                  5       nU Hk  nU R                  R                  U5      nUb<  UR                  [
        R                  :X  d  UR                  [
        R                  :w  a    gUR                  n Mm     X0R                  ;   $ )z8Checks whether the path is valid for Message Descriptor..F)
r   popfields_by_namegetlabelr   LABEL_REPEATEDtypeTYPE_MESSAGEmessage_type)r"   r   partslastr'   r(   s         r   r!   r!   `   s    
**S/%	$d--11$7E555

o222++  
22	22r   c                     U R                   nUR                  S:w  d  UR                  R                  S:w  a$  [        SR	                  UR
                  5      5      eg)z0Raises ValueError if message is not a FieldMask.r   z google/protobuf/field_mask.protozMessage {0} is not a FieldMask.N)
DESCRIPTORr'   filer   r   	full_name)messager"   s     r   r3   r3   n   s[    )),""&HH
6==$$& ' ' Ir   c                    / nSnU  H  nUR                  5       (       a  [        SR                  U 5      5      eU(       aR  UR                  5       (       a#  UR	                  UR                  5       5        SnMq  [        SR                  U 5      5      eUS:X  a  SnM  X-  nM     U(       a  [        SR                  U 5      5      eSR                  U5      $ )z2Converts a path name from snake_case to camelCase.FzYFail to print FieldMask to Json string: Path name {0} must not contain uppercase letters.znFail to print FieldMask to Json string: The character after a "_" must be a lowercase letter in path name {0}._TzFFail to print FieldMask to Json string: Trailing "_" in path name {0}. )isupperr   r   islowerr   upperr   )	path_nameresultafter_underscorecs       r   r   r   w   s    &ayy{{44:F94EG G 	
aggi    &y 13 	3 
ckf# & 
 ))/	):< <	r   c                     / nU  HU  nUS:X  a  [        SR                  U 5      5      eUR                  5       (       a  US-  nXR                  5       -  nMQ  X-  nMW     SR	                  U5      $ )z3Converts a field name from camelCase to snake_case.r^   z=Fail to parse FieldMask: Path name {0} must not contain "_"s.r_   )r   r   r`   lowerr   )rc   rd   rf   s      r   r   r      so    &aCx 44:F94EG Gyy{{mf	fkf  
r   c                   J    \ rS rSrSrSrSS jrS rS rS r	S	 r
S
 rS rSrg)r,      a%  Represents a FieldMask in a tree structure.

For example, given a FieldMask "foo.bar,foo.baz,bar.baz",
the FieldMaskTree will be:
    [_root] -+- foo -+- bar
          |       |
          |       +- baz
          |
          +- bar --- baz
In the tree, each leaf node represents a field path.
)_rootNc                 D    0 U l         U(       a  U R                  U5        gg)z"Initializes the tree by FieldMask.N)rk   r4   r   
field_masks     r   __init___FieldMaskTree.__init__   s    DJ
j) r   c                 L    UR                    H  nU R                  U5        M     g)zMerges a FieldMask to the tree.N)r
   AddPath)r   rn   r   s      r   r4   !_FieldMaskTree.MergeFromFieldMask   s      
ll4 !r   c                     U R                   nUR                  S5       H  nX2;  a  0 X#'   OX#   (       d    gX#   nM     UR                  5         g)a  Adds a field path into the tree.

If the field path to add is a sub-path of an existing field path
in the tree (i.e., a leaf node), it means the tree already matches
the given path so nothing will be added to the tree. If the path
matches an existing non-leaf node in the tree, that non-leaf node
will be turned into a leaf node with all its children removed because
the path matches all the node's children. Otherwise, a new path will
be added.

Args:
  path: The field path to add.
rM   N)rk   r   clear)r   r   noder'   s       r   rr   _FieldMaskTree.AddPath   sF     ::D

3		
zZd   	JJLr   c                 R    UR                  5         [        U R                  SU5        g)z!Converts the tree to a FieldMask.r_   N)r   _AddFieldPathsrk   rm   s     r   r-   _FieldMaskTree.ToFieldMask   s    4::r:.r   c                     U R                   nUR                  S5       H*  nXC;  a    gX4   (       d  UR                  U5          gX4   nM,     UR                  X5        g)zCalculates the intersection part of a field path with this tree.

Args:
  path: The field path to calculates.
  intersection: The out tree to record the intersection part.
rM   N)rk   r   rr   AddLeafNodes)r   r   r;   rv   r'   s        r   r:   _FieldMaskTree.IntersectPath   sU     ::D

3		zT"Zd   d)r   c                 ~    U(       d  U R                  U5        U H  nUS-   U-   nU R                  XBU   5        M!     g)z/Adds leaf nodes begin with prefix to this tree.rM   N)rr   r|   )r   prefixrv   r'   
child_paths        r   r|   _FieldMaskTree.AddLeafNodes   s;    
ll6C<$&j

J/ r   c                 2    [        U R                  XX45        g)zCMerge all fields specified by this tree from source to destination.N)_MergeMessagerk   )r   r@   rA   replace_messagereplace_repeateds        r   r?   _FieldMaskTree.MergeMessage   s     

FLr   )N)rE   rF   rG   rH   rI   rJ   ro   r4   rr   r-   r:   r|   r?   rK   r   r   r   r,   r,      s2    
 )*
2/
*"0Lr   r,   c                 R    [        U [        5      (       d  U R                  S5      $ U $ )z#Converts value to str if it is not.zutf-8)r   r   encode)r   s    r   _StrConvertr      s%    
 
E3		<<  	,r   c           	         UR                   nU  GH  nX   nUR                  U   nUc$  [        SR                  XeR                  5      5      eU(       a  UR
                  [        R                  :X  d  UR                  [        R                  :w  a$  [        SR                  XeR                  5      5      eUR                  U5      (       a   [        U[        X5      [        X&5      X45        M  UR
                  [        R                  :X  aK  U(       a  UR                  [        U5      5        [        X5      n	[        X&5      n
U
R                  U	5        GMF  UR                  [        R                  :X  a`  U(       a  UR                  [        U5      5        UR                  U5      (       a&  [        X&5      R                  [        X5      5        GM  GM  [!        X&[        X5      5        GM     g)zDMerge all fields specified by a sub-tree from source to destination.Nz+Error: Can't find field {0} in message {1}.z[Error: Field {0} in message {1} is not a singular message field and cannot have sub-fields.)rY   rO   r   r   r[   rQ   r   rR   cpp_typeCPPTYPE_MESSAGEHasFieldr   getattr
ClearFieldr   	MergeFromsetattr)rv   r@   rA   r   r   source_descriptorr'   childr(   repeated_sourcerepeated_destinations              r   r   r     s    ''dJE,,T2E}ELL
++- . .
++77
7
..O;;
; EEKV!#>#>F@A 	A 
		76('+*D	/ {{o444	{401-o$[7$$_5	?::	:

 
 T!2
3??4  
+
$
.
.wv/D
E ! 	76#89? r   c                     U (       d#  U(       a  UR                   R                  U5        g[        U 5       H#  nU(       a	  US-   U-   nOUn[        X   XB5        M%     g)z7Adds the field paths descended from node to field_mask.NrM   )r
   r   sortedry   )rv   r   rn   r'   r   s        r   ry   ry   ,  sN    	&F#
TldC<$&jj4:z6 r   N)rI   google.protobuf.descriptorr   objectr   r!   r3   r   r   r,   r   r   ry   r   r   r   <module>r      sS      6PL PLf3':VLV VLr#:L
7r   