B
    Ð»ˆd9  ã               @   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	   úU/var/www/html/venv/lib/python3.7/site-packages/tensorflow/python/tools/module_util.pyÚget_parent_dir   s    r   c             C   sr   |   d¡}|sdS ytj |d ¡}W n tk
r:   dS X |rF|jsJdS tj |j¡}tjj	|f|dd… žŽ S )aj  Get parent directory for module with the given name.

  Args:
    module_name: Module name for e.g.
      tensorflow_estimator.python.estimator.api._v1.estimator.

  Returns:
    Path to the parent directory if module is found and None otherwise.
    Given example above, it should return:
      /pathtoestimator/tensorflow_estimator/python/estimator/api/_v1.
  Ú.Nr   é   éÿÿÿÿ)
ÚsplitÚ	importlibÚutilÚ	find_specÚ
ValueErrorÚoriginr   r   r   r   )Úmodule_nameZ
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   