
    2Vh	                     *    d dl mZ  G d d      Zd Zy)    )global_statec                   &    e Zd ZdZ	 ddZd Zd Zy)
name_scopea  Creates a sub-namespace for variable paths.

    Args:
        name: Name of the current scope (string).
        caller: Optional ID of a caller object (e.g. class instance).
        deduplicate: If `True`, if `caller` was passed,
            and the previous caller matches the current caller,
            and the previous name matches the current name,
            do not reenter a new namespace.
        override_parent: Can be used to provide an absolute path
            which would override any previously opened name scopes.
    Nc                     t        |t              rd|v rt        d|       || _        || _        || _        || _        | |rt        |dd       |j                  | _        d| _	        y )N/zRArgument `name` must be a string and cannot contain character `/`. Received: name=_parent_pathF)

isinstancestr
ValueErrornamecallerdeduplicateoverride_parentgetattrr   _pop_on_exit)selfr   r   r   r   s        S/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/backend/common/name_scope.py__init__zname_scope.__init__   s~     $$t""&) 
 	&.#5A#)#6#6D !    c                    t        j                  dg d      }| j                  rK|rI|d   j                  }|d   j                  }| j                  | j                  |u r| j                  |k(  r| S |j                  |        d| _        | S )Nname_scope_stackT)defaultset_to_default)r   get_global_attributer   r   r   appendr   )r   r   parent_callerparent_names       r   	__enter__zname_scope.__enter__'   s    '<<4
  0,R077M*2.33K'KK=0II,% r   c                 h    | j                   r&t        j                  d      }|j                          y y )Nr   )r   r   r   pop)r   argskwargsr   s       r   __exit__zname_scope.__exit__8   s2    +@@"    "	 r   )NTN)__name__
__module____qualname____doc__r   r   r$    r   r   r   r      s     DH"*"#r   r   c                     t        j                  d      } | yg }| D ]T  }|j                  +|j                  j                  d      D cg c]  }|s|	 }}|j	                  |j
                         V dj                  |      S c c}w )Nr    r   )r   r   r   splitr   r   join)r   partsentryps       r   current_pathr1   @   s    #889KLE! !  , % 5 5 ; ;C @F1AQFEFUZZ ! 88E? Gs   	BBN)keras.src.backend.commonr   r   r1   r)   r   r   <module>r3      s    19# 9#x	r   