
    BVh<                     6    d Z ddlZddlZddlmZ dgZd Zd Zy)z&Traversing Python modules and classes.    N)
tf_inspecttraversec           	         
 t        j                  |       st        j                  |       sy	 t        j                  |       }t        j                  |       rZt	        | t
        j                        r@| j                  j                         D ]  }||vs|j                  |        t        |      }|| gz   } ||| |       |D ]f  \  }
t        j                  
      r
j                  t         j"                  v r8t%        
fd|D              rM|r|dz   |z   n|}	t'        
|||	       h y# t        $ rF 	 g }| j                  D ]  }|j                  |t        | |      f       ! n# t        $ r g }Y nw xY wY w xY w)zInternal helper for traverse.Nc              3   &   K   | ]  }|u  
 y w)N ).0itemchilds     P/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/tools/common/traverse.py	<genexpr>z%_traverse_internal.<locals>.<genexpr>>   s     
/T5D=
/s   .)r   isclassismodule
getmembers
issubclassenumEnum__members__itemsappendsortedImportError__all__getattrAttributeError__name__sysbuiltin_module_namesany_traverse_internal)rootvisitstackpathchildrenenum_member
child_name	new_stackname
child_pathr
   s             @r   r    r       st    
		D	!**=*=d*C
$$T*H $JtTYY$?))//1 '+h&
//+
&' !h tfn)dH <kdE>>S%=%== 
/Y
//&*d"JueY
;< 
 

h A*WT:%>?@A h
s<   A%D. D. .	E=80E)(E=)E74E=6E77E=<E=c                      t        | |g d       y)a)  Recursively enumerate all members of `root`.

  Similar to the Python library function `os.path.walk`.

  Traverses the tree of Python objects starting with `root`, depth first.
  Parent-child relationships in the tree are defined by membership in modules or
  classes. The function `visit` is called with arguments
  `(path, parent, children)` for each module or class `parent` found in the tree
  of python objects starting with `root`. `path` is a string containing the name
  with which `parent` is reachable from the current context. For example, if
  `root` is a local class called `X` which contains a class `Y`, `visit` will be
  called with `('Y', X.Y, children)`).

  If `root` is not a module or class, `visit` is never called. `traverse`
  never descends into built-in modules.

  `children`, a list of `(name, object)` pairs are determined by
  `tf_inspect.getmembers`. To avoid visiting parts of the tree, `children` can
  be modified in place, using `del` or slice assignment.

  Cycles (determined by reference equality, `is`) stop the traversal. A stack of
  objects is kept to find cycles. Objects forming cycles may appear in
  `children`, but `visit` will not be called with any object as `parent` which
  is already in the stack.

  Traversing system modules can take a long time, it is advisable to pass a
  `visit` callable which denylists such modules.

  Args:
    root: A python object with which to start the traversal.
    visit: A function taking arguments `(path, parent, children)`. Will be
      called for each object found in the traversal.
   N)r    )r!   r"   s     r   r   r   E   s    D T5"b)    )__doc__r   r   tensorflow.python.utilr   r   r    r   r   r-   r   <module>r0      s%    -  
 -,)<X"*r-   