
    BVh                         d Z ddlZddlZddlmZ  ej                  dej                        Z
d
dZi Zd
dZ	 	 ddZg d	Zy)z)Generate __all__ from a module docstring.    N)
tf_inspectz	^@@(\w+)$)flagsc           	         |t         j                  |    g}t        d t        j                  t         j                  |          D              }t               }|D ]`  }|j                  t        j                  |j                        D cg c]&  }|j                  d      |v r|j                  d      ( c}       b t        |      S c c}w )ao  Generates `__all__` from the docstring of one or more modules.

  Usage: `make_all(__name__)` or
  `make_all(__name__, [sys.modules(__name__), other_module])`. The doc string
  modules must each a docstring, and `__all__` will contain all symbols with
  `@@` references, where that symbol currently exists in the module named
  `module_name`.

  Args:
    module_name: The name of the module (usually `__name__`).
    doc_string_modules: a list of modules from which to take docstring.
    If None, then a list containing only the module named `module_name` is used.

  Returns:
    A list suitable for use as `__all__`.
  c              3   &   K   | ]	  \  }}|  y wN ).0name_s      O/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/util/all_util.py	<genexpr>zmake_all.<locals>.<genexpr>-   s      MtQdMs      )_sysmodulesset_tf_inspect
getmembersupdate_reference_patternfinditer__doc__grouplist)module_namedoc_string_modulescur_membersresults
doc_modulems         r   make_allr       s    " ,,{34 M%00k1JKM M+ E'& 3jNN/889K9KL2wwqz[0 GGAJ 2 33 
g2s   +C
c                     | t         vrt        d| z        | j                  d      d   }t         |    \  }}|s|}t        |||       y)a  Reveals a symbol that was previously removed by `remove_undocumented`.

  This should be used by tensorflow internal tests only. It explicitly
  defeats the encapsulation afforded by `remove_undocumented`.

  It throws an exception when the symbol was not hidden in the first place.

  Args:
    symbol_name: a string representing the full absolute path of the symbol.
    target_module: if specified, the module in which to restore the symbol.
  z Symbol %s is not a hidden symbol.N)_HIDDEN_ATTRIBUTESLookupErrorsplitsetattr)symbol_nametarget_modulesymbol_basenameoriginal_module
attr_values        r   reveal_undocumentedr-   >   sU     **
8;F
GG%%c*2./"4["A?J		-*5    c                 >   t        t        t        j                  |                }t	        | |      }||xs g z  }|t        |      z
  }t        j                  |    }|D ]=  }|j                  d      r| dz   |z   }|t        ||      ft        |<   t        ||       ? y)a  Removes symbols in a module that are not referenced by a docstring.

  Args:
    module_name: the name of the module (usually `__name__`).
    allowed_exception_list: a list of names that should not be removed.
    doc_string_modules: a list of modules from which to take the docstrings.
    If None, then a list containing only the module named `module_name` is used.

    Furthermore, if a symbol previously added with `add_to_global_allowlist`,
    then it will always be allowed. This is useful for internal tests.

  Returns:
    None
  r   r"   N)	r   dirr   r   r    
startswithgetattrr$   delattr)	r   allowed_exception_listr   current_symbolsshould_haveextra_symbolsr)   extra_symbolfully_qualified_names	            r   remove_undocumentedr:   R   s      DLL567/&89+'-2-+!C$44-,,{+-# )ls#X&,|;0=078D1F0G+, M<()r.   )r    r:   r-   r   )NN)r   re_resysr   tensorflow.python.utilr   r   compile	MULTILINEr   r    r$   r-   r:   __all__r   r.   r   <module>rB      sT     0   < !S[[S]]C B  6( =A+/)>r.   