o
    Q `                     @   s   d Z ddlmZ ddlmZ ddlZddlZddlmZ ddlm	Z	m
Z
mZmZ ejr9ddlmZ dd	lmZ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   )WrapFS)abspathjoinnormpathrelpath)FS)TextTuple_Fr
   T)ZboundZ	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 another 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)selfZ	parent_fspath	__class__ */usr/lib/python3/dist-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 )ClosingSubFSz>A 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&   Z
__future__r   r   typingZsixZwrapfsr   r   r   r   r   r	   ZTYPE_CHECKINGbaser
   r   r   TypeVarr   Zpython_2_unicode_compatibleZGenericr   r(   r   r   r   r   <module>   s     "