o
    ?e                     @   sb   d Z ddlZddlZddlmZ ejdej	dZ
dddZi Zddd	Z		dd
dZg dZdS )z)Generate __all__ from a module docstring.    N)
tf_inspectz	^@@(\w+)$)flagsc                    sj   |du r
t j|  g}tdd tt j|  D  t }|D ]}| fddt|jD  qt	|S )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__`.
  Nc                 s   s    | ]\}}|V  qd S N ).0name_r   r   `/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/util/all_util.py	<genexpr>-   s    
zmake_all.<locals>.<genexpr>c                    s$   g | ]}| d  v r| d qS )   )group)r   mZcur_membersr   r	   
<listcomp>2   s    zmake_all.<locals>.<listcomp>)
_sysmodulesset_tf_inspect
getmembersupdate_reference_patternfinditer__doc__list)module_namedoc_string_modulesresultsZ
doc_moduler   r   r	   make_all   s   

r   c                 C   sF   | t vr
td|  | dd }t |  \}}|s|}t||| dS )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)Zsymbol_nametarget_moduleZsymbol_basenameZoriginal_moduleZ
attr_valuer   r   r	   reveal_undocumented>   s   r%   c           	      C   s   t ttj|  }t| |}||pg 7 }|t | }tj|  }|D ]}|dr)q!| d | }|t||ft|< t|| q!dS )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   Zallowed_exception_listr   Zcurrent_symbolsZshould_haveZextra_symbolsr$   Zextra_symbolZfully_qualified_namer   r   r	   remove_undocumentedR   s   

r*   )r   r*   r%   r   )NN)r   re_resysr   Ztensorflow.python.utilr   r   compile	MULTILINEr   r   r    r%   r*   __all__r   r   r   r	   <module>   s   
!

