o
    Õ2úhì  ã                   @   s(   d Z ddlZddlZdd„ Zdd„ ZdS )zHelper functions for modules.é    Nc                 C   s    t j t j t j | j¡d¡¡S )Nz..)ÚosÚpathÚabspathÚjoinÚdirnameÚ__file__)Úmodule© r	   ú^/var/www/html/chatgem/venv/lib/python3.10/site-packages/tensorflow/python/tools/module_util.pyÚget_parent_dir   s    r   c                 C   st   |   d¡}|s	dS z
tj |d ¡}W n
 ty   Y dS w |r#|js%dS tj |j¡}tjj	|g|dd… ¢R Ž S )a  Get parent directory for module with the given name.

  Args:
    module_name: Module name, e.g. tf_keras.api._v2.keras.

  Returns:
    Path to the parent directory if module is found and None otherwise.
    Given example above, it should return:
      /root_path/tf_keras/api/_v2.
  Ú.Nr   é   éÿÿÿÿ)
ÚsplitÚ	importlibÚutilÚ	find_specÚ
ValueErrorÚoriginr   r   r   r   )Úmodule_nameÚ
name_splitÚspecÚ	base_pathr	   r	   r
   Úget_parent_dir_for_name   s   
ÿ
r   )Ú__doc__r   r   r   r   r	   r	   r	   r
   Ú<module>   s
   