o
    ?e<                     @   s:   d Z ddlZddlZddlmZ dgZdd Zdd ZdS )z&Traversing Python modules and classes.    N)
tf_inspecttraversec           
         s4  t | st | sdS z't | }t | r2t| tjr2| j D ]}||vr-|	| q"t
|}W n) ty\   zg }| jD ]}|	|t| |f q@W n tyY   g }Y nw Y nw || g }||| | |D ]-\} t  rz jtjv rzqjt fdd|D rqj|r|d | n|}	t |||	 qjdS )zInternal helper for traverse.Nc                 3   s    | ]} |u V  qd S )N ).0itemchildr   a/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/tools/common/traverse.py	<genexpr>>   s    z%_traverse_internal.<locals>.<genexpr>.)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_memberZ
child_name	new_stacknameZ
child_pathr   r   r	   r      sH   




r   c                 C   s   t | |g d dS )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    r   r   r	   r   E   s   ")__doc__r   r   Ztensorflow.python.utilr   r   r   r   r   r   r   r	   <module>   s   ,