o
    pfv                     @   s   d Z ddlmZmZ ddlZddlZddlmZmZm	Z	m
Z
 ddlmZ ejr5ddlmZmZ ddlmZ ejd	d
ddZejG dd dee eje ZG dd dee eje ZdS )z-Manage a directory in a *parent* filesystem.
    )print_functionunicode_literalsN   )abspathjoinnormpathrelpath)WrapFS)TextTuple)FS_Fr   T)bound	covariantc                       s@   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Z  Z	S )SubFSzA sub-directory on a parent filesystem.

    A SubFS is a filesystem object that maps to a sub-directory of
    another filesystem. This is the object that is returned by
    `~fs.base.FS.opendir`.

    c                    s"   t t| | tt|| _d S N)superr   __init__r   r   _sub_dir)self	parent_fspath	__class__ A/home/ertert/spirit/venv/lib/python3.10/site-packages/fs/subfs.pyr       s   zSubFS.__init__c                 C   s   d | jj| j| jS )Nz{}({!r}, {!r}))formatr   __name___wrap_fsr   r   r   r   r   __repr__%   s   zSubFS.__repr__c                 C   s   dj | j| jdS )Nz{parent}{dir})parentdir)r   r   r   r   r   r   r   __str__+   s   zSubFS.__str__c                 C   s   | j S r   )r   r   r   r   r   delegate_fs/   s   zSubFS.delegate_fsc                 C   s   t | jtt|}| j|fS r   )r   r   r   r   r   )r   r   _pathr   r   r   delegate_path3   s   
zSubFS.delegate_path)
r   
__module____qualname____doc__r   r    r#   r$   r&   __classcell__r   r   r   r   r      s    r   c                       s    e Zd ZdZ fddZ  ZS )ClosingSubFSz9A version of `SubFS` which closes its parent when closed.c                    s   |     tt|   d S r   )r$   closer   r+   r   r   r   r   r,   <   s   zClosingSubFS.close)r   r'   r(   r)   r,   r*   r   r   r   r   r+   9   s    r+   )r)   
__future__r   r   typingsixr   r   r   r   r   wrapfsr	   TYPE_CHECKINGr
   r   baser   TypeVarr   python_2_unicode_compatibleGenericr   r+   r   r   r   r   <module>   s     "