a
    ߙfb                     @   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).
    zM{} is not a directory or does not exist (the directory must be created first))	
isinstancestrospathisdirargparseArgumentTypeErrorformatabspatharg r   5lib/python3.9/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
   