U
    e»{jñ  ã                   @   s0   d Z ddlZddlZdd„ Zdd„ Zdd„ ZdS )	z1Utilities and extensions for use with `argparse`.é    Nc                 C   s2   t | tƒs&tj | ¡r&t | › d�¡‚tj | ¡S )zÌ
    An argument type (for use with the ``type=`` argument to
    `argparse.ArgumentParser.add_argument` which determines if the argument is
    an existing directory (and returns the absolute path).
    zK is not a directory or does not exist (the directory must be created first))Ú
isinstanceÚstrÚosÚpathÚisdirÚargparseÚArgumentTypeErrorÚabspath©Úarg© r   úU/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/utils/argparse.pyÚ	directory   s
    ÿr   c                 C   s*   t | ƒ} t | tj¡s&t | › d�¡‚| S )zÞ
    An argument type (for use with the ``type=`` argument to
    `argparse.ArgumentParser.add_argument` which determines if the argument is
    a directory that exists and is readable (and returns the absolute path).
    z8 exists but is not readable with its current permissions)r   r   ÚaccessÚR_OKr   r   r
   r   r   r   Úreadable_directory   s    ÿr   c                 C   s*   t | ƒ} t | tj¡s&t | › d�¡‚| S )zß
    An argument type (for use with the ``type=`` argument to
    `argparse.ArgumentParser.add_argument` which determines if the argument is
    a directory that exists and is writeable (and returns the absolute path).
    z9 exists but is not writeable with its current permissions)r   r   r   ÚW_OKr   r   r
   r   r   r   Úwriteable_directory)   s    ÿr   )Ú__doc__r   r   r   r   r   r   r   r   r   Ú<module>   s
   