
    ob                     b   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dlm	Z	 ej                  rddlmZmZ g dZ G d	 d
ej                        Z ej                   e       G d de	             Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)zManage filesystems in platform-specific application directories.

These classes abstract away the different requirements for user data
across platforms, which vary in their conventions. They are all
subclasses of `~fs.osfs.OSFS`.

    N)AppDirs   )	make_repr)OSFS)OptionalText)
UserDataFSUserConfigFS
SiteDataFSSiteConfigFSUserCacheFS	UserLogFSc                   "     e Zd ZdZ fdZ xZS )_CopyInitMetaa[  A metaclass that performs a hard copy of the `__init__`.

    This is a fix for Sphinx, which is a pain to configure in a way that
    it documents the ``__init__`` method of a class when it is inherited.
    Copying ``__init__`` makes it think it is not inherited, and let us
    share the documentation between all the `_AppFS` subclasses.

    c                     |j                  d|d   j                         t        t        j                  |   | |||      S )N__init__r   )
setdefaultr   superabcABCMeta__new__)mcls	classnamebasescls_dict	__class__s       */usr/lib/python3/dist-packages/fs/appfs.pyr   z_CopyInitMeta.__new__-   s9    Ja(9(9:S[[$/iQQ    )__name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r   #   s    R Rr   r   c                   <     e Zd ZdZdZ	 	 	 	 d fd	Zd Zd Z xZS )_AppFSz"Abstract base class for an app FS.Nc                     t        ||||      | _        || _        t        t        |   t        | j                  | j                        |       y)a  Create a new application-specific filesystem.

        Arguments:
            appname (str): The name of the application.
            author (str): The name of the author (used on Windows).
            version (str): Optional version string, if a unique location
                per version of the application is required.
            roaming (bool): If `True`, use a *roaming* profile on
                Windows.
            create (bool): If `True` (the default) the directory
                will be created if it does not exist.

        )createN)r   app_dirs_creater   r&   r   getattrapp_dir)selfappnameauthorversionroamingr(   r   s         r   r   z_AppFS.__init__;   sF    ,  'Bfd$DMM4<<0 	% 	
r   c           	         t        | j                  j                  | j                  j                  | j                  j
                  d f| j                  j                  d f| j                  j                  df| j                  df      S )NFT)r/   r0   r1   r(   )	r   r   r   r)   r.   	appauthorr0   r1   r*   r-   s    r   __repr__z_AppFS.__repr__W   sk    NN##MM!!MM++T2]]**D1]]**E2LL$'
 	
r   c                     dj                  | j                  j                  j                         | j                  j
                        S )Nz	<{} '{}'>)formatr   r   lowerr)   r.   r4   s    r   __str__z_AppFS.__str__b   s7    !!NN##))+T]]-B-B
 	
r   )NNFT)	r   r    r!   r"   r,   r   r5   r9   r#   r$   s   @r   r&   r&   2   s*    ,
 G
 
8	

r   r&   c                       e Zd ZdZdZy)r	   zA filesystem for per-user application data.

    May also be opened with
    ``open_fs('userdata://appname:author:version')``.

    user_data_dirNr   r    r!   r"   r,    r   r   r	   r	   i        Gr   r	   c                       e Zd ZdZdZy)r
   zA filesystem for per-user config data.

    May also be opened with
    ``open_fs('userconf://appname:author:version')``.

    user_config_dirNr<   r=   r   r   r
   r
   t         Gr   r
   c                       e Zd ZdZdZy)r   zA filesystem for per-user application cache data.

    May also be opened with
    ``open_fs('usercache://appname:author:version')``.

    user_cache_dirNr<   r=   r   r   r   r      s     Gr   r   c                       e Zd ZdZdZy)r   zA filesystem for application site data.

    May also be opened with
    ``open_fs('sitedata://appname:author:version')``.

    site_data_dirNr<   r=   r   r   r   r      r>   r   r   c                       e Zd ZdZdZy)r   zA filesystem for application config data.

    May also be opened with
    ``open_fs('siteconf://appname:author:version')``.

    site_config_dirNr<   r=   r   r   r   r      rA   r   r   c                       e Zd ZdZdZy)r   zA filesystem for per-user application log data.

    May also be opened with
    ``open_fs('userlog://appname:author:version')``.

    user_log_dirNr<   r=   r   r   r   r      s     Gr   r   )r"   typingr   sixappdirsr   _reprr   osfsr   TYPE_CHECKINGr   r   __all__r   r   add_metaclassr&   r	   r
   r   r   r   r   r=   r   r   <module>rR      s     
 
   	%RCKK R =!3
T 3
 "3
l  6  &   6   r   