ŨA2 x d Z ddlmZ G d de Zd Zd Zd Zd Z G d d e Z d Z d Zd ZdS )zContains FieldMask class. )FieldDescriptorc J e Zd ZdZdZd Zd Zd Zd Zd Z d Z d Z d dZdS ) FieldMaskz!Class for FieldMask message type. c g }| j D ]$}| t | %d | S )z;Converts FieldMask to string according to proto3 JSON spec.,)pathsappend_SnakeCaseToCamelCasejoin)selfcamelcase_pathspaths /builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib64/python3.11/site-packages/google/protobuf/internal/field_mask.pyToJsonStringzFieldMask.ToJsonString) sJ O : :2488999988O$$$ c " t |t s"t d | | |r?| d D ]+}| j t | *dS dS )z;Converts string to FieldMask according to proto3 JSON spec.z'FieldMask JSON value not a string: {!r}r N) isinstancestr ValueErrorformatClearsplitr r _CamelCaseToSnakeCase)r valuer s r FromJsonStringzFieldMask.FromJsonString0 s eS!! P@GGNNOOOJJLLL 7++c"" 7 7$ /5566667 77 7r c @ | j D ]}t || s dS dS )z=Checks whether the FieldMask is valid for Message Descriptor.FT)r _IsValidPath)r message_descriptorr s r IsValidForDescriptorzFieldMask.IsValidForDescriptor9 s7 ,d 3 3 uu4r c | |j D ]!}| j |j "dS )z:Gets all direct fields of Message Descriptor to FieldMask.N)r fieldsr r name)r r fields r AllFieldsFromDescriptorz!FieldMask.AllFieldsFromDescriptor@ sF JJLLL#* $ $ j ####$ $r c N t | }| | dS )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)_FieldMaskTreeToFieldMask)r masktrees r CanonicalFormFromMaskzFieldMask.CanonicalFormFromMaskF s+ $DTr c t | t | t | }| | | | dS )z+Merges mask1 and mask2 into this FieldMask.N)_CheckFieldMaskMessager' MergeFromFieldMaskr( )r mask1mask2r* s r UnionzFieldMask.UnionS sY 5!!!5!!!% DE"""Tr c t | t | t | }t }|j D ]}| || | | dS )z/Intersects mask1 and mask2 into this FieldMask.N)r- r' r IntersectPathr( )r r/ r0 r* intersectionr s r IntersectzFieldMask.Intersect[ sz 5!!!5!!!% D!##L - - |,,,,T"""""r Fc T t | }| |||| dS )a 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 sourcedestinationreplace_message_fieldreplace_repeated_fieldr* s r r7 zFieldMask.MergeMessagee sC $D24JL L L L Lr N)FF) __name__ __module____qualname____doc__ __slots__r r r r% r+ r1 r5 r7 r r r r r $ s )))% % %7 7 7 $ $ $ # # # ;@L L L L L Lr r c | d }| }|D ]R}| j | }|*|j t j k s|j t j k r dS |j } S|| j v S )z8Checks whether the path is valid for Message Descriptor..NF) r popfields_by_namegetlabelr LABEL_REPEATEDtypeTYPE_MESSAGEmessage_type)r r partslastr# r$ s r r r w s **S//% $ , ,d-11$77E 555 o222 UU+ #2 22r c | j }|j dk s|j j dk r't d |j dS )z0Raises ValueError if message is not a FieldMask.r z google/protobuf/field_mask.protozMessage {0} is not a FieldMask.N) DESCRIPTORr# filer r full_name)messager s r r- r- s_ ),,"&HHH 6==$&