
    BVh                     0    d Z ddlZddlmZ  G d d      Zy)z@Visitor restricting traversal to only the public tensorflow API.    N)
tf_inspectc                   P    e Zd ZdZd Zed        Zed        Zd Zd
dZ	d Z
d	 Zy)PublicAPIVisitorzBVisitor to use with `traverse` to visit exactly the public TF API.c                 X    || _         d| _        g ddgd| _        g ddgdgd| _        y	)
zConstructor.

    `visitor` should be a callable suitable as a visitor for `traverse`. It will
    be called only for members of the public TensorFlow API.

    Args:
      visitor: A visitor to call for the public API.
    tf)compilercoresecuritydtensorpythontsl	cpp_flags)r   ztf.flags)examplesflagsplatformpywrap_tensorflowuser_opstoolstensorboardr   mock)r   ztf.appztf.testN)_visitor
_root_name_private_map_do_not_descend_map)selfvisitors     R/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/tools/common/public_api.py__init__zPublicAPIVisitor.__init__   sC     DMDO
$ !M'D4
 )8% D    c                     | j                   S )zA map from parents to symbols that should not be included at all.

    This map can be edited, but it should not be edited once traversal has
    begun.

    Returns:
      The map marking symbols to not include.
    )r   r   s    r   private_mapzPublicAPIVisitor.private_mapT   s     r   c                     | j                   S )zA map from parents to symbols that should not be descended into.

    This map can be edited, but it should not be edited once traversal has
    begun.

    Returns:
      The map marking symbols to not explore.
    r   r!   s    r   do_not_descend_mapz#PublicAPIVisitor.do_not_descend_map`   s     ###r   c                     || _         y)z'Override the default root name of 'tf'.N)r   )r   	root_names     r   set_root_namezPublicAPIVisitor.set_root_namel   s	    DOr   Nc                     ~|| j                   v xr || j                   |   v xs0 |j                  d      xr t        j                  d|       xs |dv S )z!Return whether a name is private._z__.*__$)__base__	__class____next_in_mro__)r   
startswithrematch)r   pathnameobjs       r   _is_privatezPublicAPIVisitor._is_privatep   sd     	T&&&J443D3DT3J+J C__S!C"((9d*C&C BAADr   c                 D    || j                   v xr || j                   |   v S )zESafely queries if a specific fully qualified name should be excluded.r$   )r   r1   r2   s      r   _do_not_descendz PublicAPIVisitor._do_not_descendx   s-    D,,, 3D,,T224r   c                    t        j                  |      r9t        |j                  d            dkD  rt	        d| j
                  d|d      |rdj                  | j
                  |g      n| j
                  }t        |      D ],  \  }}| j                  |||      s|j                  ||f       . | j                  |||       t        |      D ]+  \  }}| j                  ||      s|j                  ||f       - y)z.Visitor interface, see `traverse` for details..
   zModules nested too deep:
z<

This is likely a problem with an accidental public import.N)r   ismodulelensplitRuntimeErrorr   joinlistr4   remover   r6   )r   r1   parentchildren	full_pathr2   childs          r   __call__zPublicAPIVisitor.__call__}   s     6"s4::c?';b'@//41 2 2
 6:$//401tI H~ 'e			)T5	1u&' 	MM$) H~ 'e			i	.u&'r   )N)__name__
__module____qualname____doc__r   propertyr"   r%   r(   r4   r6   rE    r   r   r   r      sH    J9v 	 	 	$ 	$ D4
'r   r   )rI   r/   tensorflow.python.utilr   r   rK   r   r   <module>rM      s    G 	 -}' }'r   