
    +d<                         d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ ddl	m
Z
mZ d Zd Zd Zd	Zd
Zd Zd Zd Zd ZdS )    N)conf)make_path_posix   )CatalogYAMLFilesCatalogc                      t                      } t          j                            |           st	                      S t          |           S )z@Return a catalog for the platform-specific user Intake directory)user_data_dirospathisdirr   r   cat_dirs    6lib/python3.11/site-packages/intake/catalog/default.pyload_user_catalogr      s9    ooG7==!! )yy(((    c                  .    t          j        dd          S )z(Return the user Intake catalog directoryintakeappname	appauthor)appdirsr	    r   r   r	   r	      s     XFFFFr   c                      t                      } t          j                            |           st	                      S t          |           S )z>Return a catalog for the environment-specific Intake directory)global_data_dirr
   r   r   r   r   r   s    r   load_global_catalogr   #   s;    G7==!! )yy(((r   CONDA_PREFIXVIRTUAL_ENVc                      	 t          j        g d          } t          j        |                                           d         S # t           j        t          j        t          f$ r Y dS w xY w)z*Fallback: ask conda in PATH for its prefix)condainfoz--jsondefault_prefixF)
subprocesscheck_outputjsonloadsdecodeCalledProcessErrorJSONDecodeErrorOSError)outs    r   conda_prefixr+   0   sk    %&A&A&ABBz#**,,''(899)4+?I   uus   AA !A)(A)c                 >    ddl }|j                            |           S )zEmulate posix ``which``r   N)distutils.spawnspawnfind_executable)program	distutilss     r   whichr2   9   s$    ?**7333r   c                  b   d} t           t          j        v rt          j        t                    } n=t          t          j        v rt          j        } nt          d          rt                      } | r.t          t          j	        
                    | dd                    S t          j        dd          S )z@Return the global Intake catalog dir for the current environmentFr   sharer   r   )VIRTUALENV_VARr
   environ	CONDA_VARsysprefixr2   r+   r   r   joinr   site_data_dir)r9   s    r   r   r   @   s    F#  N+	bj	   	w   Krw||FGXFFGGG$XJJJJr   c                     t                      } t                      }d}g }t          j                            |           r0|                    | dz              |                    | dz              t          j                            |          r0|                    |dz              |                    |dz              t          j        dg           D ]c}|dk    r[|                    d          s1|                    |dz              |                    |dz              N|                    |           dt          |d|          S )	z<Load a union of the user and global catalogs for conveniencez=Generated from data packages found on your intake search pathz/*.yamlz/*.ymlcatalog_path )yamlymlbuiltin)namedescription)
r	   r   r
   r   r   appendr   getendswithr   )user_dir
global_dirdesccat_dirspath_dirs        r   load_combo_catalogrL   R   s>   H ""JJDH	w}}X -9,---8+,,,	w}}Z   /
Y.///
X-...H^R00 * *r> 	*$$_55 *9 45558 34444)))H9$GGGGr   )r$   r
   r"   r8   r   intake.configr   intake.utilsr   localr   r   r   r	   r   r7   r5   r+   r2   r   rL   r   r   r   <module>rP      s     				     



        ( ( ( ( ( ( , , , , , , , ,) ) )G G G
) ) ) 	  4 4 4K K K$H H H H Hr   