§
    P„j”  ã                   óŒ   — d Z ddlZddlZddlZddlmZ ddlmZ dedefd„Z	dede
fd„Zdedefd	„Z ej        e	e¦  «         dS )
z9Module for reading gin configs in the python system path.é    N)ÚAny)ÚconfigÚconfig_pathÚreturnc                 ól   — t          | ¦  «        }t          |¦  «        }t          j        d|¦  «         |S )zÞLoads a gin config as a resource from within a package.

  Args:
    config_path: Path to the gin file, e.g. /foo/bar/config/walker2d.gin and
      foo.bar.config/walker2d.gin

  Returns:
    An open file to the config.
  z"gin-config opened resource file:%s)Ú_parse_config_pathÚopenÚloggingÚinfo)r   ÚpathÚfs      úX/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/gin/resource_reader.pyÚsystem_path_readerr      s4   € õ 
˜KÑ	(Ô	(€$Ý
ˆ4�j„j€!Ý	„,Ð3°TÑ:Ô:Ð:Ø	
€(ó    c                 óò   — t          j        d| ¦  «         	 t          | ¦  «        }n3# t          t          t
          f$ r t          j        d| ¦  «         Y dS w xY wt          j         	                    |¦  «        S )zÍChecks if the config_path points to a config on the Python system path.

  Args:
    config_path: String path to the gin file, e.g. /foo/bar/config/walker2d.gin.

  Returns:
    True if the file exists.
  zsystem_path_file_exists:%szPath not found: %sF)
r
   r   r   ÚModuleNotFoundErrorÚ
ValueErrorÚImportErrorÚerrorÚosr   Úisfile)r   r   s     r   Úsystem_path_file_existsr   )   s}   € õ 
„,Ð+¨[Ñ9Ô9Ð9ðÝ˜kÑ*Ô*€D€DøÝ
�z­;Ð	7ð ð ð å„MÐ&¨Ñ4Ô4Ð4Øˆ5ˆ5ðøøøõ
 
Œ�Š˜Ñ	Ô	Ðs   —' §,AÁAc                 ó`  — t           j                             | ¦  «        \  }}|                     dd¦  «        }t          j                             |¦  «        }|€t          d|¦  «        ‚|j        }t           j         	                    t           j         
                    |¦  «        |¦  «        }|S )a[  Turns config_path into path to the config in python system path.

  Path is split into head and filename using `os.path.split`. The head is
  treated as a Python package and the filename as a gin file. Path to where the
  package is located on the fileystem is determined and then joined with the
  filename.

  `importlib.resources` was not used because it is new in python 3.7.

  Args:
    config_path: String path to the gin file, e.g.
    /foo/bar/config/walker2d.gin.

  Returns:
    Absolute path to gin config in python system path.

  Raises:
    ValueError: if the package cannot be loaded.
  ú/ú.NzPackage not found)r   r   ÚsplitÚreplaceÚ	importlibÚutilÚ	find_specr   ÚoriginÚjoinÚdirname)r   ÚheadÚfilenameÚpkgÚspecÚfile_sys_pathr   s          r   r   r   =   sˆ   € õ( ”7—=’= Ñ-Ô-�.€$ˆØ�Š�S˜#ÑÔ€#å	Œ×	!Ò	! #Ñ	&Ô	&€$Ø	€\Ý
Ð(¨#Ñ
.Ô
.Ð.Ø”+€-å	Œ�Š•b”g—o’o mÑ4Ô4°hÑ	?Ô	?€$Ø	€+r   )Ú__doc__r   r
   r   Útypingr   Úginr   Ústrr   Úboolr   r   Úregister_file_reader© r   r   ú<module>r0      sÖ   ðð  @Ð ?Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð ð Cð ¨Cð ð ð ð ð ¨ð °ð ð ð ð ð( Cð ¨Cð ð ð ð ð@ €Ô Ð.Ð0GÑ HÔ HÐ HÐ HÐ Hr   