o
    oÄŽil  ã                   @   s6   d dl mZ d dlZd dlmZ G dd„ deeƒZdS )é    )ÚEnumN)ÚOptionalc                   @   s6   e Zd ZdZdZdZdZdZede	d  fdd„ƒZ
d	S )
ÚFileCacheModeaØ  Enumeration of the modes available for for the cloudpathlib file cache.

    Attributes:
        persistent (str): Cache is not removed by `cloudpathlib`.
        tmp_dir (str): Cache is stored in a
            [`TemporaryDirectory`](https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory)
            which is removed when the Client object is garbage collected (or by the OS at some point if not).
        cloudpath_object (str): Cache for a `CloudPath` object is removed when `__del__` for that object is
            called by Python garbage collection.
        close_file (str): Cache for a `CloudPath` file is removed as soon as the file is closed. Note: you must
            use `CloudPath.open` whenever opening the file for this method to function.

    Modes can be set by passing them to the Client or by setting the `CLOUDPATHLIB_FILE_CACHE_MODE`
    environment variable.

    For more detail, see the [caching documentation page](../../caching).
    Ú
persistentÚtmp_dirÚcloudpath_objectÚ
close_fileÚreturnc                 C   s"   t j dd¡ ¡ }|sdS | |ƒS )zËParses the environment variable `CLOUDPATHLIB_FILE_CACHE_MODE` into
        an instance of this Enum.

        Returns:
            FileCacheMode enum value if the env var is defined, else None.
        ÚCLOUDPATHLIB_FILE_CACHE_MODEÚ N)ÚosÚenvironÚgetÚlower)ÚclsÚ
env_string© r   úN/home/jeff/fluffinator/venv/lib/python3.10/site-packages/cloudpathlib/enums.pyÚfrom_environment   s   	zFileCacheMode.from_environmentN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   Úclassmethodr   r   r   r   r   r   r      s    r   )Úenumr   r   Útypingr   Ústrr   r   r   r   r   Ú<module>   s    