
    i~                        S SK r S SKrS SKJrJr  S SKJr  S SKJrJ	r	  S SK
Jr  S SKJrJrJrJrJrJrJrJrJr  S SKJr  SS	KJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%  SS
K&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1  SSK2J3r3  SSK4J5r5  \\6\7\8\\9\:4   r;\ " S S5      5       r<\ " S S\<5      5       r= " S S\5      r> " S S\>5      r? " S S\?5      r@ " S S\5      rA " S S\?5      rBg)    N)ABCabstractmethod)defaultdict)	dataclassfield)Enum)	AnyDictIteratorListOptionalSetTupleTypeUnion)ParserRuleContext   )_DEFAULT_MARKER_NoneType	ValueKind
_get_value_is_interpolation_is_missing_value_is_specialformat_and_raiseget_value_kindis_union_annotationis_valid_value_annotation	split_keytype_str)	ConfigKeyErrorConfigTypeErrorInterpolationKeyErrorInterpolationResolutionError InterpolationToMissingValueErrorInterpolationValidationErrorMissingMandatoryValueUnsupportedInterpolationTypeValidationError)OmegaConfGrammarParser)parse)GrammarVisitorc                       \ rS rSr% \\\   \4   \S'   \\\   \4   \S'   \\S'   \\S'   Sr	\
\\\4      \S'   Sr\\S	'   \" S
 S9r\\\4   \S'   SS jr\S\\\   \4   4S j5       rSrg)Metadata,   ref_typeobject_typeoptionalkeyNflagsF
flags_rootc                       [        [        5      $ N)r   dict     M/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/omegaconf/base.py<lambda>Metadata.<lambda>A   s	    ;tCTr:   )default_factoryresolver_cachereturnc                 .    U R                   c  0 U l         g g r7   r4   selfs    r;   __post_init__Metadata.__post_init__C   s    ::DJ r:   c                 b    U R                   (       a  [        U R                     $ U R                  $ )z<Compute `type_hint` from `self.optional` and `self.ref_type`)r2   r   r0   rC   s    r;   	type_hintMetadata.type_hintG   s$     ==DMM**== r:   rB   r@   N)__name__
__module____qualname____firstlineno__r   r   r	   __annotations__boolr4   r   r
   strr5   r   r?   rE   propertyrH   __static_attributes__r9   r:   r;   r.   r.   ,   s     DIsN##tCy#~&&N	H (,E8DdO$+ J%*;T%UNDcNU !5cC0 ! !r:   r.   c                   <    \ rS rSr% Sr\\S'   Sr\\S'   SS jrSr	g)ContainerMetadataS   Nkey_typeelement_typec                 V   U R                   c  [        U l         U R                  [        L d!  [        U R                  [        5      (       d   eU R
                  b;  [        U R
                  5      (       d!  [        S[        U R
                  SS9 S35      eU R                  c  0 U l	        g g )NzUnsupported value type: 'T)include_module_name')
r0   r	   rW   
isinstancetyperX   r   r)   r    r4   rC   s    r;   rE   ContainerMetadata.__post_init__X   s    == DM}}#z$--'F'FFF(,T->->??%/9J9J`d0e/ffgh  ::DJ r:   )r4   r0   rJ   )
rK   rL   rM   rN   rW   r	   rO   rX   rE   rS   r9   r:   r;   rU   rU   S   s    HcL#r:   rU   c                   t   \ rS rSr% \\S'   \S   \S'   \\\\\	   4      \S'   S\S   S\4S jr
S	\\\4   4S
 jrS\\\4   S	S4S jrS\S   S	S4S jrS8S jrS	\S   4S jrS	\S   4S jrS\\\   \4   S\\\\	      \\	   4   S	S 4S jrS\S	\\	   4S jrS\S	\\	   4S jrS\S	\\	   4S jr  S9S\S\S\S\\   S\S	S4S jjr\S\\\\4      S	\4S  j5       rS:S! jr  S;S"\	S#\\\      S	\S    4S$ jjr  S<S"\	S#\\\      S	\S    4S% jjr!S=S& jr"S	\	4S' jr#S	\	4S( jr$\S)\S	\	4S* j5       r%\S)\S	\	4S+ j5       r&\S	\4S, j5       r'\S	\4S- j5       r(\S<S\S\\\\	4      S	S4S. jj5       r)\S	\	4S/ j5       r*\S	\	4S0 j5       r+S	\4S1 jr,S\S	S4S2 jr-S	\	4S3 jr.S4\	S	S4S5 jr/S	\	4S6 jr0S7r1g)>Nodef   	_metadataBox_parent_flags_cacheparentmetadatac                 Z    X R                   S'   XR                   S'   S U R                   S'   g )Nrb   rd   re   __dict__)rD   rf   rg   s      r;   __init__Node.__init__l   s(    %-k"#)i (,n%r:   r@   c                 L    [         R                   " U R                  5      nUS	 U$ Nre   )copyrj   rD   
state_dicts     r;   __getstate__Node.__getstate__q   s"    YYt}}-
~&r:   rq   Nc                 X    U R                   R                  U5        S U R                   S'   g rn   )rj   updaterp   s     r;   __setstate__Node.__setstate__w   s"    Z((,n%r:   c                 t    Ub  [        U[        5      (       d   eXR                  S'   U R                  5         g Nrd   )r\   rc   rj   _invalidate_flags_cacherD   rf   s     r;   _set_parentNode._set_parent{   s1    ~FC!8!888#)i $$&r:   c                 "    S U R                   S'   g rn   ri   rC   s    r;   rz   Node._invalidate_flags_cache   s    (,n%r:   c                 X    U R                   S   nUb  [        U[        5      (       d   eU$ ry   )rj   r\   rc   r{   s     r;   _get_parentNode._get_parent   s,    y)~FC!8!888r:   	Containerc                    U R                   S   nUb  [        U[        5      (       d   e[        U[        5      (       a+  UR                   S   nUb  [        U[        5      (       d   eU$ Ub  [        U[        5      (       d   eU$ )zc
Like _get_parent, but returns the grandparent
in the case where `self` is wrapped by a UnionNode.
rd   )rj   r\   rc   	UnionNoder   )rD   rf   grandparents      r;   _get_parent_containerNode._get_parent_container   s~    
 y)~FC!8!888fi(( //)4K&*[)*L*LLL>Z	%B%BBBMr:   r4   valuesc                 >   [        U[        5      (       a  U/nUb  [        U[        5      (       a  U/n[        U5      S:X  a  [        U5      U-  n[        U5      [        U5      :w  a  [	        S5      e[        U5       H  u  p4X#   nUcM  U R                  R                  c   eX@R                  R                  ;   a  U R                  R                  U	 MW  MY  U R                  R                  c   eXPR                  R                  U'   M     U R                  5         U $ )Nr   z3Inconsistent lengths of input flag names and values)	r\   rQ   rP   len
ValueError	enumeraterb   r4   rz   )rD   r4   r   idxflagvalues         r;   	_set_flagNode._set_flag   s    
 eS!!GE>Z55XFv;!Z&(Fu:V$RSS"5)ICKE}~~++777>>///,,T2 0 ~~++777-2$$T* * 	$$&r:   r   c                 ~    U R                   R                  c   eU R                   R                  R                  U5      $ )zK
:param flag: flag to inspect
:return: the state of the flag on this node.
)rb   r4   get)rD   r   s     r;   _get_node_flagNode._get_node_flag   s5    
 ~~##///~~##''--r:   c                     U R                   S   nUc  0 =o R                   S'   UR                  U[        5      nU[        L a  U R                  U5      nX2U'   Ub  [	        U[
        5      (       d   eU$ rn   )rj   r   r   _get_flag_no_cacher\   rP   )rD   r   cacherets       r;   	_get_flagNode._get_flag   ss    n-=466EMM.1ii./""))$/C$K{jd3333
r:   c                     U R                   R                  nUc   eX;   a	  X!   b  X!   $ U R                  5       (       a  gU R                  5       nUc  gUR	                  U5      $ )z
Returns True if this config node flag is set
A flag is set if node.set_flag(True) was called
or one if it's parents is flag is set
:return:
N)rb   r4   _is_flags_rootr   r   )rD   r   r4   rf   s       r;   r   Node._get_flag_no_cache   sn     $$   =U[4;  !!#> ##D))r:   r3   r   causemsgtype_overridec           	      >    [        U UUUc  [        U5      OUUUS9   e)N)noder3   r   r   r   r   )r   rQ   )rD   r3   r   r   r   r   s         r;   _format_and_raiseNode._format_and_raise   s/     	!kE
s'	
 	ur:   c                     g r7   r9   rD   r3   s     r;   _get_full_keyNode._get_full_key       r:   c                 .    U R                  SS9nUc   eU$ )NT)throw_on_resolution_failure_dereference_node_impl)rD   r   s     r;   _dereference_nodeNode._dereference_node   s&    **t*Lr:   r   memoc                 "    U R                  UUS9$ )Nr   r   r   )rD   r   r   s      r;   _maybe_dereference_nodeNode._maybe_dereference_node   s"    
 **(C + 
 	
r:   c           
          U R                  5       (       d  U $ U R                  5       nUc  U(       a  [        S5      eg Uc   eU R                  5       nUR	                  UUU [        [        U 5      5      UUS9$ )Nz8Cannot resolve interpolation for a node without a parent)rf   r3   r   
parse_treer   r   )r   r   r$   _key&_resolve_interpolation_from_parse_treer+   r   )rD   r   r   rf   r3   s        r;   r   Node._dereference_node_impl  s    
 %%''K++->*2N  !!!iik<<Z-.(C = 
 	
r:   c                 b   U R                  5       nUc  [        U [        5      (       d   eU $ Ub  [        U[        5      (       d   eUR                  5       b=  UR                  5       nUb  [        U[        5      (       d   eUR                  5       b  M=  Ub  [        U[        5      (       d   eU$ r7   )r   r\   r   rc   )rD   roots     r;   	_get_rootNode._get_root  s    "..0<dI....KJtS$9$999 ,##%D#
4(=(===  , JtY$?$???r:   c                     [        U 5      $ )zI
Check if the node's value is `???` (does *not* resolve interpolations).
)r   rC   s    r;   _is_missingNode._is_missing*  s     !&&r:   c                 &    U R                  5       SL $ )zJ
Check if the node's value is `None` (does *not* resolve interpolations).
N)_valuerC   s    r;   _is_noneNode._is_none0  s     {{}$$r:   otherc                     g r7   r9   rD   r   s     r;   __eq__Node.__eq__6  r   r:   c                     g r7   r9   r   s     r;   __ne__Node.__ne__:  r   r:   c                     g r7   r9   rC   s    r;   __hash__Node.__hash__>  r   r:   c                     g r7   r9   rC   s    r;   r   Node._valueB  r   r:   c                     g r7   r9   )rD   r   r4   s      r;   
_set_valueNode._set_valueF  r   r:   c                     g r7   r9   rC   s    r;   _is_optionalNode._is_optionalJ  r   r:   c                     g r7   r9   rC   s    r;   r   Node._is_interpolationN  r   r:   c                 .    U R                   R                  $ r7   rb   r3   rC   s    r;   r   	Node._keyR  s    ~~!!!r:   c                 $    XR                   l        g r7   r   r   s     r;   _set_keyNode._set_keyU  s     r:   c                 .    U R                   R                  $ r7   )rb   r5   rC   s    r;   r   Node._is_flags_rootX  s    ~~(((r:   r5   c                 z    U R                   R                  U:w  a!  XR                   l        U R                  5         g g r7   )rb   r5   rz   )rD   r5   s     r;   _set_flags_rootNode._set_flags_root[  s/    >>$$
2(2NN%((* 3r:   c                 :    U R                   R                  [        L$ r7   )rb   r0   r	   rC   s    r;   _has_ref_typeNode._has_ref_type`  s    ~~&&c11r:   r9   rJ   NN)r@   r`   )FNr7   )r@   r   )2rK   rL   rM   rN   r.   rO   r   r
   rQ   rP   rk   r	   rr   rv   r|   rz   r   r   r   r   r   r   r   r   	Exceptionr   r   DictKeyTypeintr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rS   r9   r:   r;   r`   r`   f   sr   e_4Xd^ 3455-x -( -
d38n -tCH~ -$ -'(5/ 'd '
-Xe_ 
x'<  T#Y^$ d8D>*HTN:; 
	:.3 .8D> .
c 
htn 
*s *x~ *6 "!  	
 c]  
$ %S0@*A!B s   -2#'
%)
 s3x 
 
&		
 $(
%)
 s3x 
 
&		
4
'T '%$ % C D   C D   #       HT#t)_,E QU   d   4  "c "!C !D !) )+$ +4 +
2t 2r:   r`   c                   b   ^  \ rS rSr% Sr\\S'   S\S    S\4U 4S jjr	S\4S jr
SS	 jrS
rU =r$ )rc   id  zw
Base class for nodes that can contain other nodes.
Concrete subclasses include DictConfig, ListConfig, and UnionNode.
_contentrf   rg   c                 >   > [         TU ]  XS9  S U R                  S'   g )Nrf   rg   r   )superrk   rj   )rD   rf   rg   	__class__s      r;   rk   Box.__init__l  s!    :$(j!r:   r@   c                 .    [         R                  " U 5      $ r7   )ro   deepcopyrC   s    r;   __copy__Box.__copy__p  s    }}T""r:   c                 <   SSK Jn  SSKJn  [	        X5      (       a  U R
                  S   n[	        U[        5      (       ab  U R
                  S   R                  5        H@  u  pEUb  UR                  U 5        [	        U[        5      (       d  M0  UR                  5         MB     g g [	        X5      (       aw  U R
                  S   n[	        U[        5      (       aR  U R
                  S    H>  nUb  UR                  U 5        [	        U[        5      (       d  M.  UR                  5         M@     g g [	        U [        5      (       a]  U R
                  S   n[	        U[        5      (       a8  UR                  U 5        [	        U[        5      (       a  UR                  5         g g g g )Nr   
DictConfig
ListConfigr   )
dictconfigr   
listconfigr   r\   rj   r8   itemsr|   rc   
_re_parentlistr   r`   )rD   r   r   contentr   r   items          r;   r  Box._re_parentt  sN   ** d''mmJ/G'4((#'==#<#B#B#DKD())$/!%--((*	 $E ) ))mmJ/G'4(( MM*5D'((.!$,,)	 6 ) i((mmJ/G'4((##D)gs++ &&( , ) )r:   r9   rJ   )rK   rL   rM   rN   __doc__r	   rO   r   r.   rk   r   r  rS   __classcell__r   s   @r;   rc   rc   d  s<    
 M)x )( )## #) )r:   rc   c                      \ rS rSr% Sr\\S'   \    S,S\S\	S\	S\	S\	S	\
\\   \\\      4   4S
 jj5       r\    S,S\S\	S\	S\	S\	S	\
\\   \\\      4   4S jj5       r\S\S	S4S j5       r\S\S\S	S4S j5       r\S	\\   4S j5       r\S\S	\4S j5       rS\S	\S \4   4S jr S-S\S\	S\	S\\\      S	\\S    \\   \\   4   4
S jjrS\S    SSS\S\R8                  S\	S\\\      S	\S   4S jrS\S    SSS\S\S\	S	\S   4S jrS\S\S	S4S  jrS!\S\\\      S	S4S" jr S\S\S#\S$\\S%4   S&\\S%4   S	\4S' jr! S-S\S    S\S\S\	S\\\      S	\\   4S( jjr"  S.S\#S\S\\\      S\\   S	\4
S) jjr$S/S* jr%S+r&g)0r   i  z
Container tagging interface
rb   r3   validate_accessvalidate_keythrow_on_missing_valuethrow_on_missing_keyr@   c                     g r7   r9   rD   r3   r
  r  r  r  s         r;   
_get_childContainer._get_child       	r:   c                     g r7   r9   r  s         r;   	_get_nodeContainer._get_node  r  r:   Nc                     g r7   r9   r   s     r;   __delitem__Container.__delitem__  r   r:   r   c                     g r7   r9   )rD   r3   r   s      r;   __setitem__Container.__setitem__  r   r:   c                     g r7   r9   rC   s    r;   __iter__Container.__iter__  r   r:   key_or_indexc                     g r7   r9   )rD   r  s     r;   __getitem__Container.__getitem__  r   r:   c                    UnUR                  S5      (       d  U R                  5       U4$ U nUR                  S5      (       d   e Uc   eUSS  nUR                  S5      (       d   X14$ UR                  5       nUc  [        SU S35      eMH  )N.r   zError resolving key 'r[   )
startswithr   r   r!   )rD   r3   origr   s       r;   _resolve_key_and_rootContainer._resolve_key_and_root  s    ~~c"">>#S(((,D>>#&&&&'''!"g~~c**
 9	 113<(+@a)HII r:   throw_on_missingr   r   c           
         SSK Jn  US:X  a  U SU 4$ [        U5      nU n[        [	        U5      S-
  5       H  nUc    OXh   n	U" UU	UUS9u  p[        U
[        5      (       a  U
R                  UUS9n
U
bH  [        U
[        5      (       d3  SR                  USUS-    5      nXhS-      n[        S	U S
U SU S35      eU
nM     Uc  gUS   nU" UUUUS9u  pUc  X~S4$ Ub-  [        U5      nUU;   a  [        S5      eUR                  U5         UR                  UUUUUS9nUb  UR                  W5        X~U4$ ! Ub  UR                  W5        f f = f)z1
Select a value using dot separated key sequence
r   )_select_one N)cr3   r)  throw_on_type_errorr   r$  r   zError trying to access z: node `z.` is not a container and thus cannot contain ``)NNNz Recursive interpolation detected)rf   r3   r   r   r   )	omegaconfr+  r   ranger   r\   r`   r   r   joinr"   idr$   add_maybe_resolve_interpolationremove)rD   r3   r)  r   r   r+  splitr   ikr   _
parent_key	child_keylast_keyr   vids                    r;   _select_implContainer._select_impl  s    	+"9T>!#$(s5zA~&A|A !1$?	FC #t$$110K 2 
 z#y'A'A XXeAA&67
!a%L	%-cU(:, GCCL+QP  D1 '4 <#9- ;	
 =4''U)Cd{23UVVHHSM	!55,G 6 E C u$$	 C   s   D: :Erf   r`   r   c                 z     U R                  XBX6S9nU R                  UUUUUS9$ ! [         a    U(       a  e  gf = f)aK  
Resolve an interpolation.

This happens in two steps:
    1. The parse tree is visited, which outputs either a `Node` (e.g.,
       for node interpolations "${foo}"), a string (e.g., for string
       interpolations "hello ${name}", or any other arbitrary value
       (e.g., or custom interpolations "${foo:bar}").
    2. This output is potentially validated and converted when the node
       being resolved (`value`) is typed.

If an error occurs in one of the above steps, an `InterpolationResolutionError`
(or a subclass of it) is raised, *unless* `throw_on_resolution_failure` is set
to `False` (in which case the return value is `None`).

:param parent: Parent of the node being resolved.
:param value: Node being resolved.
:param key: The associated key in the parent.
:param parse_tree: The parse tree as obtained from `grammar_parser.parse()`.
:param throw_on_resolution_failure: If `False`, then exceptions raised during
    the resolution of the interpolation are silenced, and instead `None` is
    returned.

:return: A `Node` that contains the interpolation result. This may be an existing
    node in the config (in the case of a node interpolation "${foo}"), or a new
    node that is created to wrap the interpolated value. It is `None` if and only if
    `throw_on_resolution_failure` is `False` and an error occurs during resolution.
)r   r   r3   r   N)rf   r   r3   resolvedr   )resolve_parse_treer$   *_validate_and_convert_interpolation_result)rD   rf   r   r3   r   r   r   rC  s           r;   r   0Container._resolve_interpolation_from_parse_tree!  se    L	..%s / H >>(C ? 
 	
 , 	*	s   % ::rC  c           
         SSK JnJnJn  [	        U[
        5      (       + n	[	        X(5      (       aI  [	        X&5      (       d9  [        U5      n
 UR                  U
5      n[        U5      [        U
5      :w  a  Sn	UnU	(       a  U" XCUS9$ [	        U[
        5      (       d   eU$ ! [         a.  nU(       a  U R                  UU
USU SU 3[        S9   S nAg S nAff = f)Nr   )AnyNodeInterpolationResultNode	ValueNodez#While dereferencing interpolation 'z': )r3   r   r   r   r   T)r   r3   rf   )nodesrH  rI  rJ  r\   r`   r   validate_and_convertr)   r   r&   r]   )rD   rf   r   r3   rC  r   rH  rI  rJ  	must_wrap	res_value
conv_valuees                r;   rE  4Container._validate_and_convert_interpolation_resultX  s     	GF #8T22	 e''
50J0J"8,I"77	B
 J4	?2 	%*6RRh----O- # 	.**'A%A3O&B +  	s   B   
C*$CCr   targetc                 X    UnUb%  X2L a  [        S5      eUR                  5       nUb  M$  g g )Nz%Interpolation to parent node detected)r$   r   )rD   r   rR  rf   s       r;   %_validate_not_dereferencing_to_parent/Container._validate_not_dereferencing_to_parent  s;    !% 2;  '')F  r:   	inter_keyc                     U R                  U5      u  p1 UR                  USSUS9u  pVnUb  Uc  [        SU S35      eU R                  XS	9  U$ ! [         a8  n[        SU 35      R                  [        R
                  " 5       S   5      eSnAff = f! [         a8  n[        SU 35      R                  [        R
                  " 5       S   5      eSnAff = f)
z0A node interpolation is of the form `${foo.bar}`z.ConfigKeyError while resolving interpolation:    NT)r)  r   r   z5MissingMandatoryValue while resolving interpolation: zInterpolation key 'z' not found)r   rR  )
r'  r!   r#   with_tracebacksysexc_infor@  r'   r%   rT  )rD   rV  r   	root_nodeexcrf   r>  r   s           r;   _resolve_node_interpolation%Container._resolve_node_interpolation  s    	0#'#=#=i#H I
	0&/&<&<!%,0	 '= '#Fe >U]'*=i[(TUU66D6OL+  	0'@FnS\\^A./0	0 % 	02GuMnS\\^A./0	0s.   A B 
B3BB
C 3CC
inter_type
inter_args.inter_args_strc                     SSK Jn  UR                  U5      nUb  U R                  5       nU" UU UUU5      $ [	        SU 35      e)Nr   )	OmegaConfzUnsupported interpolation type )r1  rd  _get_resolverr   r(   )	rD   r3   r   r`  ra  rb  rd  resolverr\  s	            r;   _evaluate_custom_resolver#Container._evaluate_custom_resolver  s^     	(**:6(I  /1*> r:   c           	          [        U5      nU[        R                  :w  a  U$ [        [	        U5      5      nU R                  UUUUUUb  US9$ [        5       S9$ )N)rf   r   r3   r   r   r   )r   r   INTERPOLATIONr+   r   r   set)rD   rf   r3   r   r   r   
value_kindr   s           r;   r6  &Container._maybe_resolve_interpolation  su     $E*
000L:e,-
::!(C) ; 
 	
 03u ; 
 	
r:   c                   ^ ^^ S[         S[        [        [              S[        S   4U 4S jjnS[         S[        [
        S4   S	[        [         S4   S[
        4UUU 4S
 jjn[        UUUS9n UR                  U5      $ ! [         a    e [         aM  n[        [        U5      R                   SU 35      R                  [        R                  " 5       S   5      eSnAff = f)z
Resolve a given parse tree into its value.

We make no assumption here on the type of the tree's root, so that the
return value may be of any type.
rV  r   r@   r`   c                 "   > TR                  XS9$ )N)rV  r   )r^  )rV  r   rD   s     r;   node_interpolation_callbackAContainer.resolve_parse_tree.<locals>.node_interpolation_callback  s     33i3SSr:   nameargs.args_strc                 *   > TR                  TTU UUS9$ )N)r3   r   r`  ra  rb  )rg  )rr  rs  rt  r3   r   rD   s      r;   resolver_interpolation_callbackEContainer.resolve_parse_tree.<locals>.resolver_interpolation_callback  s,     11' 2  r:   )rp  rv  r   z' raised while resolving interpolation: rX  N)rQ   r   r   r   r   r	   r,   visitr$   r   r]   rK   rY  rZ  r[  )	rD   r   r   r   r3   rp  rv  visitorr]  s	   ` ` `    r;   rD  Container.resolve_parse_tree  s    	T	T"*3s8"4	Tf	T
				"38_		8=c3h				 		 !(C,K

	0==,,+ 	 	0.9%%&&McUSnS\\^A./0	0s   /B   C!ACC!c                    SSK Jn  SSKJn  U R                  S   b  S U R                  S'   [        X5      (       aZ  U R                  S   n[        U[        5      (       a5  U R                  S   R                  5        H  nUR                  5         M     g g [        X5      (       aL  U R                  S   n[        U[        5      (       a'  U R                  S    H  nUR                  5         M     g g g g )Nr   r   r   re   r   )
r   r   r   r   rj   r\   r8   r   rz   r  )rD   r   r   r  r   r  s         r;   rz   !Container._invalidate_flags_cache  s    ** ==(4,0DMM.)$++--
3gt,,!%z!:!A!A!C557 "D - D----
3gt,, $j 9446 !: - . 5r:   r9   )TTFFr7   r   rJ   )'rK   rL   rM   rN   r  rU   rO   r   r	   rP   r   r   r`   r   r  r  r  r  r   r  r!  rQ   r   r'  r   r   r@  r*   ConfigValueContextr   rE  rT  r^  rg  r6  r   rD  rz   rS   r9   r:   r;   r   r     s    !  !%!',%*  	
 !% # 
x~tHTN33	4   !%!',%*  	
 !% # 
x~tHTN33	4  s t   s 3 4   (3-       {C7G1H . $(L%L% L% &*	L%
 s3x L% 
x$hsmXd^C	DL%\5
%5
 5
 	5

 +==5
 &*5
 s3x 5
 
&	5
n)%) ) 	)
 ) &*) 
&	)V*$ * *QU *$,SX$6	:  	
 #s(O c3h 
> $(
%
 
 	

 &*
 s3x 
 
$
4 $(!+0%+0 +0 s3x 	+0
 c]+0 
+0Z7r:   r   c                        \ rS rSrSrSrSrSrg)SCModei  r   rX     r9   N)rK   rL   rM   rN   DICTDICT_CONFIGINSTANTIATErS   r9   r:   r;   r  r    s    DKKr:   r  c                     ^  \ rS rSr% Sr\\   \S'   \\	S\
4   \S'      SS\S\S\S	\S
\\   SS4U 4S jjjrS	\\\\4      S\
4S jrS\S\4S jrS\S\4S jrS\4S jrS\\	S\
4   4S jrSS\S\\\
\4      SS4S jjr SS\S\\\
\4      SS4S jjrS\4S jrS\4S jrS\
4S jrS\
4S jrS\\\4   SS 4S jrSrU =r$ ) r   i  a  
This class handles Union type hints. The `_content` attribute is either a
child node that is compatible with the given Union ref_type, or it is a
special value (None or MISSING or interpolation).

Much of the logic for e.g. value assignment and type validation is
delegated to the child node. As such, UnionNode functions as a
"pass-through" node. User apps and downstream libraries should not need to
know about UnionNode (assuming they only use OmegaConf's public API).
rd   Nr   r  r0   is_optionalr3   rf   r@   c                 L  >  [        U5      (       d  SU S3S-   n[        U5      e[        U[        [        45      (       d  [        S5      e[        TU ]  U[        US UUSS0S9S9  U R                  U5        g ! [         a  n[        S XA[        U5      US	9   S nAg S nAff = f)
Nz"UnionNode got unexpected ref_type z. Please file a bugz3 report at https://github.com/omry/omegaconf/issuesz&Parent type is not omegaconf.ContainerconvertF)r0   r1   r2   r3   r4   r   )r   r3   r   r   r   )r   AssertionErrorr\   r   r   r"   r   rk   r.   r   r   r   rQ   )	rD   r  r0   r  r3   rf   r   exr   s	           r;   rk   UnionNode.__init__.  s    	W&x008
BUVKL  %S))fy(&;<<%&NOOG!% $($e,  	 OOG$ 	W$CCGSUV	Ws   A6A: :
B#BB#c                     U R                  5       nUc7  U R                  R                  c  g[        U R                  R                  5      $ UR	                  U R                  R                  5      $ )Nr,  )r   rb   r3   rQ   r   )rD   r3   rf   s      r;   r   UnionNode._get_full_keyM  sX    !!#>~~!!)4>>--..''(:(:;;r:   r   c                 .   U R                   S   n[        U[        5      (       a  UR                  U5      nO8[        U[        5      (       a  UR                  U5      nOUR                  U5      n[        U[        [        [        5      45      (       d   eU$ Nr   )rj   r\   r`   r   rP   r]   NotImplemented)rD   r   r  r   s       r;   r   UnionNode.__eq__W  sv    --
+gt$$..'Ct$$,,w'C..'C#d>&:;<<<<
r:   c                 P    U R                  U5      nU[        L a  [        $ U(       + $ r7   )r   r  )rD   r   xs      r;   r   UnionNode.__ne__b  s%    KK!!ur:   c                 2    [        U R                  S   5      $ r  )hashrj   rC   s    r;   r   UnionNode.__hash__h      DMM*-..r:   c                 h    U R                   S   n[        U[        [        [        45      (       d   eU$ r  )rj   r\   r`   r   rQ   )rD   r  s     r;   r   UnionNode._valuek  s/    --
+'D(C#89999r:   r   r4   c                     U R                   S   nU R                   S   n U R                  X5        g ! [         a#  nX0R                   S'   X@R                   S'   UeS nAff = f)Nr   rb   )rj   _set_value_implr   )rD   r   r4   previous_contentprevious_metadatarP  s         r;   r   UnionNode._set_valuep  s`    ==4 MM+6	  . 	(8MM*%):MM+&G	s   2 
AAAc           	      T   SSK Jn  U R                  R                  nU R                  R                  n[        U5      n[        U5      (       a\  [        U[        [        45      (       d   eUc-  U R                  5       (       d  [        S[        U5       S35      eXR                  S'   g [        U[        5      (       a  [        S[        U5       35      eUR                   H  n U" UUSS U S9U R                  S'     g    [        S	[        U5       S35      e! [         a     MD  f = f)
Nr   )
_node_wrapz/Value '$VALUE' is incompatible with type hint 'r[   r   z:Cannot assign container '$VALUE' of type '$VALUE_TYPE' to F)r   r0   r  r3   rf   zEValue '$VALUE' of type '$VALUE_TYPE' is incompatible with type hint ')omegaconf.omegaconfr  rb   r0   rH   r   r   r\   rQ   r   r   r)   r    rj   r   __args__)rD   r   r4   r  r0   rH   candidate_ref_types          r;   r  UnionNode._set_value_implz  s6    	3>>**NN,,	5!uec8_5555}((**)I(S\J]I^^_`  ).MM*%y))!LXV_M`Lab  '/&7&7"
0:#!3$) #1DMM*-  '8 &[\den\o[ppqr  ' s   &D
D'&D'c                 8    U R                   S   R                  SL $ )Nrb   T)rj   r2   rC   s    r;   r   UnionNode._is_optional  s    }}[)22d::r:   c                 2    [        U R                  S   5      $ r  )r   rj   rC   s    r;   r   UnionNode._is_interpolation  s     z!:;;r:   c                 2    [        U R                  S   5      $ r  )rQ   rj   rC   s    r;   __str__UnionNode.__str__  s    4==,--r:   c                 2    [        U R                  S   5      $ r  )reprrj   rC   s    r;   __repr__UnionNode.__repr__  r  r:   r   c                 @   [         R                  [        U 5      5      nU R                  R	                  5        H.  u  p4US;  d  M  [
        R                  " XAS9UR                  U'   M0     U R                  S   n[        U[        5      (       aP  UR                  S   n S UR                  S'   [
        R                  " XQS9nX'R                  S'   XeR                  S'   OUnXrR                  S'   U R                  S   UR                  S'   U$ ! XeR                  S'   f = f)N)r   rd   )r   r   rd   )	object__new__r]   rj   r   ro   r   r\   r`   )rD   r   resr3   r   src_content
old_parentcontent_copys           r;   __deepcopy__UnionNode.__deepcopy__  s    nnT$Z(----/JC11$(MM%$CS! 0 mmJ/k4(($--i8J=26$$Y/#}}[D36%%i02<$$Y/ 'L#/Z "&--	":Y
 3=$$Y/s   1D Dr9   )TNNr7   ) rK   rL   rM   rN   r  r   r   rO   r   r`   rQ   r	   rP   rc   rk   r   r   r   r   r   r   r   r
   r   r  r   r   r  r  r  rS   r  r  s   @r;   r   r     s   	 i  D$O$$ ! $WW W 	W
 W W 
W W><%S0@*A!B <s <	C 	D 	C D /# /dD#o. 
 HT#t)_,E QU  >B%%!)$sDy/!:%	%N;d ;<4 <. ./# /c3h K  r:   r   )Cro   rZ  abcr   r   collectionsr   dataclassesr   r   enumr   typingr	   r
   r   r   r   r   r   r   r   antlr4r   _utilsr   r   r   r   r   r   r   r   r   r   r   r   r    errorsr!   r"   r#   r$   r%   r&   r'   r(   r)   "grammar.gen.OmegaConfGrammarParserr*   grammar_parserr+   grammar_visitorr,   rQ   bytesr   floatrP   r   r.   rU   r`   rc   r   r  r   r9   r:   r;   <module>r     s     
 # # (  O O O $   
 
 
 G ! +CT5$67 #! #! #!L   ${23 {2|-)$ -)`B7 B7JT c cr:   