
    BVhr                     @    d Z d Zd Z G d de      Z G d de      Zy)z(Utilities used to capture Python idioms.c                 F    t        | t              r| j                         S | S )zLoad variable operator.)
isinstance	Undefinedread)vs    _/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/autograph/operators/variables.pyldr      s    9668O	
(    c                 \    	  |        S # t         t        t        f$ r t        |      cY S w xY w)a  Load variable operator that returns Undefined when failing to evaluate.

  Note: the name ("load or return undefined") is abbreviated to minimize
  the amount of clutter in generated code.

  This variant of `ld` is useful when loading symbols that may be undefined at
  runtime, such as composite symbols, and whether they are defined or not cannot
  be determined statically. For example `d['a']` is undefined when `d` is an
  empty dict.

  Args:
    load_v: Lambda that executes the actual read.
    name: Human-readable name of the symbol being read.
  Returns:
    Either the value of the symbol, or Undefined, if the symbol is not fully
    defined.
  )KeyErrorAttributeError	NameErrorr   )load_vnames     r   ldur      s.    $8O
NI	. T?s   	 ++c                   2    e Zd ZdZdZd Zd Zd Zd Zd Z	y)	r   a  Represents an undefined symbol in Python.

  This is used to reify undefined symbols, which is required to use the
  functional form of loops.
  Example:

    while n > 0:
      n = n - 1
      s = n
    return s  # Runtime error if n == 0

  This is valid Python code and will not result in an error as long as n
  is positive. The use of this class is to stay as close to Python semantics
  as possible for staged code of this nature.

  Converted version of the above showing the possible usage of this class:

    s = Undefined('s')
    init_state = (s,)
    s = while_loop(cond, body, init_state)
    return s  # s is an instance of Undefined if the loop never runs

  Attributes:
    symbol_name: Text, identifier for the undefined symbol
  symbol_namec                     || _         y Nr   )selfr   s     r   __init__zUndefined.__init__O   s
    "Dr	   c                 J    t        dj                  | j                              )Nz'{}' is used before assignment)UnboundLocalErrorformatr   r   s    r   r   zUndefined.readR   s&    
<CC  r	   c                     | j                   S r   r   r   s    r   __repr__zUndefined.__repr__V   s    r	   c                 R    	 t         j                  | |      S # t        $ r | cY S w xY wr   )object__getattribute__r   )r   r   s     r   r    zUndefined.__getattribute__Y   s.    $$T400 ks    &&c                     | S r    )r   is     r   __getitem__zUndefined.__getitem__a   s    Kr	   N)
__name__
__module____qualname____doc__	__slots__r   r   r   r    r$   r"   r	   r   r   r   2   s'    4 )#r	   r   c                       e Zd ZdZy)UndefinedReturnValuez,Represents a return value that is undefined.N)r%   r&   r'   r(   r"   r	   r   r+   r+   f   s    4r	   r+   N)r(   r   r   r   r   r+   r"   r	   r   <module>r,      s-    /20 0h6 r	   