
    ob=                     |   d Z ddlmZmZmZ ddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlmZ ddlmZmZ ddlmZmZmZmZmZmZmZ ddlmZ dd	lmZ dd
lmZ ddl m!Z!m"Z"m#Z# ddlm$Z$ ddlm%Z% ejL                  rddlm'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m6Z6 ddlm7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z=m>Z> ddl?m@Z@ ddlAmBZB ddlmCZC  ej                  dd      ZE ej                  dd      ZFe*eFe2geBeF   f   ZGdgZHd ZI e
j                  ej                         G d deL             ZMy)zPyFilesystem base class.

The filesystem base class is common to all filesystems. If you
familiarize yourself with this (rather straightforward) API, you
can work with any of the supported filesystems.

    )absolute_importprint_functionunicode_literalsN)closing)partialwraps   )copyerrorsfsencodeiotoolstoolswalkwildcard)copy_modified_timeBoundGlobber)validate_open_mode)abspathjoinnormpath)datetime_to_epoch)Walker)IOAnyBinaryIOCallable
CollectionDictIterableIteratorListMappingOptionalTextTupleTypeUnion)datetime)RLock)TracebackType)ResourceType)InfoRawInfo)PermissionsSubFS)BoundWalker_FFS)bound_Tc                      t                fd       }dj                   j                        }t        |dd      |xj                  |z  c_        |S )z+Return a method with a deprecation warning.c                  |    t        j                  dj                  j                        t                | i |S )Nz6method '{}' has been deprecated, please rename to '{}')warningswarnformat__name__DeprecationWarning)argskwargsmethodold_names     )/usr/lib/python3/dist-packages/fs/base.py_methodz_new_name.<locals>._methodI   s=    DKK&// 		
 t&v&&    zR
        Note:
            .. deprecated:: 2.2.0
                Please use `~{}`
__doc__N)r   r;   r<   getattrrE   )r@   rA   rC   deprecated_msgs   ``  rB   	_new_namerH   E   s\     6]' ' F	  w	4(4>)NrD   c                   j    e Zd ZdZi ZeZdZ fdZd Z	d Z
d Zed        Zed        Zej                   dFd	       Zej                   d
        Zej                   	 	 dGd       Zej                   	 	 dHd       Zej                   d        Zej                   d        Zej                   d        Zd Z	 	 	 dIdZd Z	 	 dJdZ	 	 dJdZdKdZd Zd Z	 	 	 	 	 	 dLdZ d Z! e"e!d      Z#dFdZ$ e"e$d      Z%	 	 	 dMdZ& e"e&d      Z'd Z(dNd Z)d! Z*d" Z+d# Z,d$ Z-dOd%Z.d& Z/dOd'Z0d( Z1d) Z2d* Z3d+ Z4d, Z5d- Z6dJd.Z7	 	 dGd/Z8dJd0Z9	 	 	 	 	 dPd1Z:	 dFd2Z;d3 Z<	 	 dQd4Z=d5 Z> e"e>d6      Z?dFd7Z@ e"e@d8      ZA	 	 	 dMd9ZB e"eBd:      ZCdQd;ZD	 	 	 dId<ZE e"eEd=      ZFd> ZGd? ZHd@ ZIdA ZJdB ZKdC ZLdD ZMdE ZN xZOS )Rr4   zBase class for FS objects.Nc                 j    d| _         t        j                         | _        t        t
        |           y)zACreate a filesystem. See help(type(self)) for accurate signature.FN)_closed	threadingr*   _locksuperr4   __init__)self	__class__s    rB   rO   zFS.__init__m   s'     __&
b$ "rD   c                 $    | j                          y)z"Auto-close the filesystem on exit.NcloserP   s    rB   __del__z
FS.__del__t   s    

rD   c                     | S )z-Allow use of filesystem as a context manager. rU   s    rB   	__enter__zFS.__enter__x   s	     rD   c                 $    | j                          y)zClose filesystem on exit.NrS   )rP   exc_type	exc_value	tracebacks       rB   __exit__zFS.__exit__}   s     	

rD   c                     t        |       S )z+`~fs.glob.BoundGlobber`: a globber object..r   rU   s    rB   globzFS.glob   s     D!!rD   c                 8    | j                   j                  |       S )z:`~fs.walk.BoundWalker`: a walker bound to this filesystem.)walker_classbindrU   s    rB   r   zFS.walk   s       %%d++rD   c                      y)aK  Get information about a resource on a filesystem.

        Arguments:
            path (str): A path to a resource on the filesystem.
            namespaces (list, optional): Info namespaces to query. The
                `"basic"` namespace is alway included in the returned
                info, whatever the value of `namespaces` may be.

        Returns:
            ~fs.info.Info: resource information object.

        Raises:
            fs.errors.ResourceNotFound: If ``path`` does not exist.

        For more information regarding resource information, see :ref:`info`.

        NrX   )rP   path
namespacess      rB   getinfoz
FS.getinfo       rD   c                      y)a0  Get a list of the resource names in a directory.

        This method will return a list of the resources in a directory.
        A *resource* is a file, directory, or one of the other types
        defined in `~fs.enums.ResourceType`.

        Arguments:
            path (str): A path to a directory on the filesystem

        Returns:
            list: list of names, relative to ``path``.

        Raises:
            fs.errors.DirectoryExpected: If ``path`` is not a directory.
            fs.errors.ResourceNotFound: If ``path`` does not exist.

        NrX   rP   re   s     rB   listdirz
FS.listdir   rh   rD   c                      y)ah  Make a directory.

        Arguments:
            path (str): Path to directory from root.
            permissions (~fs.permissions.Permissions, optional): a
                `Permissions` instance, or `None` to use default.
            recreate (bool): Set to `True` to avoid raising an error if
                the directory already exists (defaults to `False`).

        Returns:
            ~fs.subfs.SubFS: a filesystem whose root is the new directory.

        Raises:
            fs.errors.DirectoryExists: If the path already exists.
            fs.errors.ResourceNotFound: If the path is not found.

        NrX   )rP   re   permissionsrecreates       rB   makedirz
FS.makedir   rh   rD   c                      y)aP  Open a binary file-like object.

        Arguments:
            path (str): A path on the filesystem.
            mode (str): Mode to open file (must be a valid non-text mode,
                defaults to *r*). Since this method only opens binary files,
                the ``b`` in the mode string is implied.
            buffering (int): Buffering policy (-1 to use default buffering,
                0 to disable buffering, or any positive integer to indicate
                a buffer size).
            **options: keyword arguments for any additional information
                required by the filesystem (if any).

        Returns:
            io.IOBase: a *file-like* object.

        Raises:
            fs.errors.FileExpected: If ``path`` exists and is not a file.
            fs.errors.FileExists: If the ``path`` exists, and
                *exclusive mode* is specified (``x`` in the mode).
            fs.errors.ResourceNotFound: If ``path`` does not exist and
                ``mode`` does not imply creating the file, or if any
                ancestor of ``path`` does not exist.

        NrX   )rP   re   mode	bufferingoptionss        rB   openbinz
FS.openbin   rh   rD   c                      y)a	  Remove a file from the filesystem.

        Arguments:
            path (str): Path of the file to remove.

        Raises:
            fs.errors.FileExpected: If the path is a directory.
            fs.errors.ResourceNotFound: If the path does not exist.

        NrX   rj   s     rB   removez	FS.remove   rh   rD   c                      y)a  Remove a directory from the filesystem.

        Arguments:
            path (str): Path of the directory to remove.

        Raises:
            fs.errors.DirectoryNotEmpty: If the directory is not empty (
                see `~fs.base.FS.removetree` for a way to remove the
                directory contents).
            fs.errors.DirectoryExpected: If the path does not refer to
                a directory.
            fs.errors.ResourceNotFound: If no resource exists at the
                given path.
            fs.errors.RemoveRootError: If an attempt is made to remove
                the root directory (i.e. ``'/'``)

        NrX   rj   s     rB   	removedirzFS.removedir  rh   rD   c                      y)a  Set info on a resource.

        This method is the complement to `~fs.base.FS.getinfo`
        and is used to set info values on a resource.

        Arguments:
            path (str): Path to a resource on the filesystem.
            info (dict): Dictionary of resource info.

        Raises:
            fs.errors.ResourceNotFound: If ``path`` does not exist
                on the filesystem

        The ``info`` dict should be in the same format as the raw
        info returned by ``getinfo(file).raw``.

        Example:
            >>> details_info = {"details": {
            ...     "modified": time.time()
            ... }}
            >>> my_fs.setinfo('file.txt', details_info)

        NrX   )rP   re   infos      rB   setinfoz
FS.setinfo!  rh   rD   c                     t        |t              st        d      | j                  5  | j	                  |d      5 }|j                  |       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)ac  Append bytes to the end of a file, creating it if needed.

        Arguments:
            path (str): Path to a file.
            data (bytes): Bytes to append.

        Raises:
            TypeError: If ``data`` is not a `bytes` instance.
            fs.errors.ResourceNotFound: If a parent directory of
                ``path`` does not exist.

        zmust be bytesabN)
isinstancebytes	TypeErrorrM   openwrite)rP   re   dataappend_files       rB   appendbyteszFS.appendbytesA  sm     $&O,,ZZ 	(4& (+!!$'(	( 	(( (	( 	(s"   A*AA*A'	#A**A3c                    t        |t        j                        st        d      | j                  5  | j                  |d|||      5 }|j                  |       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)a_  Append text to the end of a file, creating it if needed.

        Arguments:
            path (str): Path to a file.
            text (str): Text to append.
            encoding (str): Encoding for text files (defaults to ``utf-8``).
            errors (str, optional): What to do with unicode decode errors
                (see `codecs` module for more information).
            newline (str): Newline parameter.

        Raises:
            TypeError: if ``text`` is not an unicode string.
            fs.errors.ResourceNotFound: if a parent directory of
                ``path`` does not exist.

        zmust be unicode stringat)encodingr   newlineN)r~   six	text_typer   rM   r   r   )rP   re   textr   r   r   r   s          rB   
appendtextzFS.appendtextV  s    2 $.455ZZ 	(dXfg   (!!$'(	( 	(( (	( 	(s#   A8	A,A8,A5	1A88Bc                     d| _         y)a  Close the filesystem and release any resources.

        It is important to call this method when you have finished
        working with the filesystem. Some filesystems may not finalize
        changes until they are closed (archives for example). You may
        call this method explicitly (it is safe to call close multiple
        times), or you can use the filesystem as a context manager to
        automatically close.

        Example:
            >>> with OSFS('~/Desktop') as desktop_fs:
            ...    desktop_fs.writetext(
            ...        'note.txt',
            ...        "Don't forget to tape Game of Thrones"
            ...    )

        If you attempt to use a filesystem that has been closed, a
        `~fs.errors.FilesystemClosed` exception will be thrown.

        TN)rK   rU   s    rB   rT   zFS.closew  s    , rD   c                 :   | j                   5  |s&| j                  |      rt        j                  |      t	        | j                  |d            5 }| j                  ||       ddd       |rt        | || |       ddd       y# 1 sw Y   "xY w# 1 sw Y   yxY w)a  Copy file contents from ``src_path`` to ``dst_path``.

        Arguments:
            src_path (str): Path of source file.
            dst_path (str): Path to destination file.
            overwrite (bool): If `True`, overwrite the destination file
                if it exists (defaults to `False`).
            preserve_time (bool): If `True`, try to preserve mtime of the
                resource (defaults to `False`).

        Raises:
            fs.errors.DestinationExists: If ``dst_path`` exists,
                and ``overwrite`` is `False`.
            fs.errors.ResourceNotFound: If a parent directory of
                ``dst_path`` does not exist.
            fs.errors.FileExpected: If ``src_path`` is not a file.

        rbN)rM   existsr   DestinationExistsr   r   uploadr   )rP   src_pathdst_path	overwritepreserve_time	read_files         rB   r
   zFS.copy  s    4 ZZ 	CX!6..x888T23 1yHi01 "44B	C 	C1 1	C 	Cs$   ABB$BB	
BBc                 *   | j                   5  |s&| j                  |      st        j                  |      | j	                  |      j
                  st        j                  |      t        j                  | || ||       ddd       y# 1 sw Y   yxY w)a  Copy the contents of ``src_path`` to ``dst_path``.

        Arguments:
            src_path (str): Path of source directory.
            dst_path (str): Path to destination directory.
            create (bool): If `True`, then ``dst_path`` will be created
                if it doesn't exist already (defaults to `False`).
            preserve_time (bool): If `True`, try to preserve mtime of the
                resource (defaults to `False`).

        Raises:
            fs.errors.ResourceNotFound: If the ``dst_path``
                does not exist, and ``create`` is not `True`.
            fs.errors.DirectoryExpected: If ``src_path`` is not a
                directory.

        r   N)	rM   r   r   ResourceNotFoundrg   is_dirDirectoryExpectedr
   copy_dir)rP   r   r   creater   s        rB   copydirz
FS.copydir  sz    2 ZZ 	W$++h"7--h77<<)00..x88MM$$V	W 	W 	Ws   A3B		Bc                     | j                   5  |s| j                  |      r
	 ddd       yt        | j                  |d            5  	 ddd       	 ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)a  Create an empty file.

        The default behavior is to create a new file if one doesn't
        already exist. If ``wipe`` is `True`, any existing file will
        be truncated.

        Arguments:
            path (str): Path to a new file in the filesystem.
            wipe (bool): If `True`, truncate any existing
                file to 0 bytes (defaults to `False`).

        Returns:
            bool: `True` if a new file had to be created.

        NFwbT)rM   r   r   r   )rP   re   wipes      rB   r   z	FS.create  sp    " ZZ 	DKK-	 	 4./ 	 	 	 	s(   A&A&A	A&A#	A&&A/c                     | j                  |      st        j                  |      	 | j                  |      }|S # t        j                  t        j                  f$ r dj                  ||       cY S w xY w)a(  Return a short descriptive text regarding a path.

        Arguments:
            path (str): A path to a resource on the filesystem.

        Returns:
            str: a short description of the path.

        Raises:
            fs.errors.ResourceNotFound: If ``path`` does not exist.

        z{} on {})r   r   r   
getsyspath	NoSysPathr;   )rP   re   syspaths      rB   desczFS.desc  sp     {{4 ))$//	ood+G N '')9)9: 	1$$T400	1s   ; 5A32A3c                 Z    	 | j                  |       y# t        j                  $ r Y yw xY w)zCheck if a path maps to a resource.

        Arguments:
            path (str): Path to a resource.

        Returns:
            bool: `True` if a resource exists at the given path.

        TF)rg   r   r   rj   s     rB   r   z	FS.exists  s2    	LL  && 		s    **c                      j                  ||      }g  fd}	 fd}
 fd} fd}|rj                  t        |
|             |rj                  t        |	|             |rj                  t        ||             |rj                  t        ||             rfd|D        }t        |      }||\  }}t	        j
                  |||      }|S )a  Get an iterator of resource info, filtered by patterns.

        This method enhances `~fs.base.FS.scandir` with additional
        filtering functionality.

        Arguments:
            path (str): A path to a directory on the filesystem.
            files (list, optional): A list of UNIX shell-style patterns
                to filter file names, e.g. ``['*.py']``.
            dirs (list, optional): A list of UNIX shell-style patterns
                to filter directory names.
            exclude_dirs (list, optional): A list of patterns used
                to exclude directories.
            exclude_files (list, optional): A list of patterns used
                to exclude files.
            namespaces (list, optional): A list of namespaces to include
                in the resource information, e.g. ``['basic', 'access']``.
            page (tuple, optional): May be a tuple of ``(<start>, <end>)``
                indexes to return an iterator of a subset of the resource
                info, or `None` to iterate over the entire directory.
                Paging a directory scan may be necessary for very large
                directories.

        Returns:
            ~collections.abc.Iterator: an iterator of `Info` objects.

        rf   c                 X    |j                   xs j                  | |j                        S zPattern match info.name.is_filematchnamepatternsrz   rP   s     rB   	match_dirzFS.filterdir.<locals>.match_dir<  s#     <<B4::h		#BBrD   c                 X    |j                   xs j                  | |j                        S r   r   r   r   r   s     rB   
match_filez FS.filterdir.<locals>.match_fileA  s#     ;;A$**Xtyy"AArD   c                 Z    |j                   xs j                  | |j                         S r   r   r   s     rB   exclude_dirz!FS.filterdir.<locals>.exclude_dirF  s&     <<Ftzz(DII'F#FFrD   c                 Z    |j                   xs j                  | |j                         S r   r   r   s     rB   exclude_filez"FS.filterdir.<locals>.exclude_fileK  s&     ;;Edjj499&E"EErD   c              3   N   K   | ]  t        fd D              s  yw)c              3   .   K   | ]  } |        y wNrX   ).0_filterrz   s     rB   	<genexpr>z)FS.filterdir.<locals>.<genexpr>.<genexpr>[  s     1WG'$-1Ws   N)all)r   rz   filterss    @rB   r   zFS.filterdir.<locals>.<genexpr>Z  s#      c1Ww1W.Ws   %%)scandirappendr   iter	itertoolsislice)rP   re   filesdirsexclude_dirsexclude_filesrf   page	resourcesr   r   r   r   	iter_infostartendr   s   `               @rB   	filterdirzFS.filterdir  s    L LL*L=		C
	B
	G
	F
 NN7:u56NN79d34NN7;=>NN7<?@!*I O	JE3!((E3?IrD   c                     t        | j                  |d            5 }|j                         }ddd       |S # 1 sw Y   S xY w)a^  Get the contents of a file as bytes.

        Arguments:
            path (str): A path to a readable file on the filesystem.

        Returns:
            bytes: the file contents.

        Raises:
            fs.errors.FileExpected: if ``path`` exists but is not a file.
            fs.errors.ResourceNotFound: if ``path`` does not exist.

        r   rq   Nr   r   read)rP   re   r   contentss       rB   	readbyteszFS.readbytesd  sA     TYYt$Y/0 	(I ~~'H	(	(s	   8Agetbytesc                     | j                   5   | j                  |fi |5 }t        j                  |||       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)a  Copy a file from the filesystem to a file-like object.

        This may be more efficient that opening and copying files
        manually if the filesystem supplies an optimized method.

        Note that the file object ``file`` will *not* be closed by this
        method. Take care to close it after this method completes
        (ideally with a context manager).

        Arguments:
            path (str): Path to a resource.
            file (file-like): A file-like object open for writing in
                binary mode.
            chunk_size (int, optional): Number of bytes to read at a
                time, if a simple copy is used, or `None` to use
                sensible default.
            **options: Implementation specific options required to open
                the source file.

        Example:
            >>> with open('starwars.mov', 'wb') as write_file:
            ...     my_fs.download('/Videos/starwars.mov', write_file)

        Raises:
            fs.errors.ResourceNotFound: if ``path`` does not exist.

        
chunk_sizeNrM   rt   r   copy_file_data)rP   re   filer   rs   r   s         rB   downloadzFS.downloady  sj    : ZZ 	Md.g. M)$$YLM	M 	MM M	M 	Ms!   AAAA	AA getfilec           	          t        | j                  |d|||            5 }|j                         }ddd       |S # 1 sw Y   S xY w)a  Get the contents of a file as a string.

        Arguments:
            path (str): A path to a readable file on the filesystem.
            encoding (str, optional): Encoding to use when reading contents
                in text mode (defaults to `None`, reading in binary mode).
            errors (str, optional): Unicode errors parameter.
            newline (str): Newlines parameter.

        Returns:
            str: file contents.

        Raises:
            fs.errors.ResourceNotFound: If ``path`` does not exist.

        rtrq   r   r   r   Nr   )rP   re   r   r   r   r   r   s          rB   readtextzFS.readtext  sW    0 II4(67  
 	(  ~~'H	( 	( s	   ;Agettextc                 >    | j                  |dg      j                  S )a  Get the timestamp of the last modifying access of a resource.

        Arguments:
            path (str): A path to a resource.

        Returns:
            datetime: The timestamp of the last modification.

        The *modified timestamp* of a file is the point in time
        that the file was last changed. Depending on the file system,
        it might only have limited accuracy.

        detailsr   )rg   modifiedrj   s     rB   getmodifiedzFS.getmodified  s     ||Di[|9BBBrD   c                 L    |dk(  r| j                   j                         }|S i }|S )aj  Get meta information regarding a filesystem.

        Arguments:
            namespace (str): The meta namespace (defaults
                to ``"standard"``).

        Returns:
            dict: the meta information.

        Meta information is associated with a *namespace* which may be
        specified with the ``namespace`` parameter. The default namespace,
        ``"standard"``, contains common information regarding the
        filesystem's capabilities. Some filesystems may provide other
        namespaces which expose less common or implementation specific
        information. If a requested namespace is not supported by
        a filesystem, then an empty dictionary will be returned.

        The ``"standard"`` namespace supports the following keys:

        =================== ============================================
        key                 Description
        ------------------- --------------------------------------------
        case_insensitive    `True` if this filesystem is case
                            insensitive.
        invalid_path_chars  A string containing the characters that
                            may not be used on this filesystem.
        max_path_length     Maximum number of characters permitted in
                            a path, or `None` for no limit.
        max_sys_path_length Maximum number of characters permitted in
                            a sys path, or `None` for no limit.
        network             `True` if this filesystem requires a
                            network.
        read_only           `True` if this filesystem is read only.
        supports_rename     `True` if this filesystem supports an
                            `os.rename` operation.
        =================== ============================================

        Most builtin filesystems will provide all these keys, and third-
        party filesystems should do so whenever possible, but a key may
        not be present if there is no way to know the value.

        Note:
            Meta information is constant for the lifetime of the
            filesystem, and may be cached.

        standard)_metar
   )rP   	namespacemetas      rB   getmetaz
FS.getmeta  s0    ` 
"::??$D  DrD   c                 <    | j                  |      j                  }|S )a+  Get the size (in bytes) of a resource.

        Arguments:
            path (str): A path to a resource.

        Returns:
            int: the *size* of the resource.

        Raises:
            fs.errors.ResourceNotFound: if ``path`` does not exist.

        The *size* of a file is the total number of readable bytes,
        which may not reflect the exact number of bytes of reserved
        disk space (or other storage medium).

        The size of a directory is the number of bytes of overhead
        use to store the directory entry.

        )
getdetailssize)rP   re   r   s      rB   getsizez
FS.getsize  s    * t$))rD   c                 .    t        j                  |      )a  Get the *system path* of a resource.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            str: the *system path* of the resource, if any.

        Raises:
            fs.errors.NoSysPath: If there is no corresponding system path.

        A system path is one recognized by the OS, that may be used
        outside of PyFilesystem (in an application or a shell for
        example). This method will get the corresponding system path
        that would be referenced by ``path``.

        Not all filesystems have associated system paths. Network and
        memory based filesystems, for example, may not physically store
        data anywhere the OS knows about. It is also possible for some
        paths to have a system path, whereas others don't.

        This method will always return a str on Py3.* and unicode
        on Py2.7. See `~getospath` if you need to encode the path as
        bytes.

        If ``path`` doesn't have a system path, a `~fs.errors.NoSysPath`
        exception will be thrown.

        Note:
            A filesystem may return a system path even if no
            resource is referenced by that path -- as long as it can
            be certain what that system path would be.

        re   )r   r   rj   s     rB   r   zFS.getsyspath  s    H D))rD   c                 >    | j                  |      }t        |      }|S )aU  Get the *system path* to a resource, in the OS' prefered encoding.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            str: the *system path* of the resource, if any.

        Raises:
            fs.errors.NoSysPath: If there is no corresponding system path.

        This method takes the output of `~getsyspath` and encodes it to
        the filesystem's prefered encoding. In Python3 this step is
        not required, as the `os` module will do it automatically. In
        Python2.7, the encoding step is required to support filenames
        on the filesystem that don't encode correctly.

        Note:
            If you want your code to work in Python2.7 and Python3 then
            use this method if you want to work with the OS filesystem
            outside of the OSFS interface.

        )r   r   )rP   re   r   ospaths       rB   	getospathzFS.getospathC  s!    2 //$''"rD   c                 <    | j                  |      j                  }|S )a  Get the type of a resource.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            ~fs.enums.ResourceType: the type of the resource.

        Raises:
            fs.errors.ResourceNotFound: if ``path`` does not exist.

        A type of a resource is an integer that identifies the what
        the resource references. The standard type integers may be one
        of the values in the `~fs.enums.ResourceType` enumerations.

        The most common resource types, supported by virtually all
        filesystems are ``directory`` (1) and ``file`` (2), but the
        following types are also possible:

        ===================   ======
        ResourceType          value
        -------------------   ------
        unknown               0
        directory             1
        file                  2
        character             3
        block_special_file    4
        fifo                  5
        socket                6
        symlink               7
        ===================   ======

        Standard resource types are positive integers, negative values
        are reserved for implementation specific resource types.

        )r   type)rP   re   resource_types      rB   gettypez
FS.gettype`  s    L -22rD   c                 .    t        j                  ||      )a  Get the URL to a given resource.

        Arguments:
            path (str): A path on the filesystem
            purpose (str): A short string that indicates which URL
                to retrieve for the given path (if there is more than
                one). The default is ``'download'``, which should return
                a URL that serves the file. Other filesystems may support
                other values for ``purpose``: for instance, `OSFS` supports
                ``'fs'``, which returns a FS URL (see :ref:`fs-urls`).

        Returns:
            str: a URL.

        Raises:
            fs.errors.NoURL: If the path does not map to a URL.

        )r   NoURL)rP   re   purposes      rB   geturlz	FS.geturl  s    ( ll4))rD   c                 f    d}	 | j                  |       |S # t        j                  $ r d}Y |S w xY w)zCheck if a path maps to a system path.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            bool: `True` if the resource at ``path`` has a *syspath*.

        TF)r   r   r   )rP   re   has_sys_paths      rB   
hassyspathzFS.hassyspath  sD     	!OOD!   	! L	!s    00c                 j    d}	 | j                  ||       |S # t        j                  $ r d}Y |S w xY w)a-  Check if a path has a corresponding URL.

        Arguments:
            path (str): A path on the filesystem.
            purpose (str): A purpose parameter, as given in
                `~fs.base.FS.geturl`.

        Returns:
            bool: `True` if an URL for the given purpose exists.

        T)r   F)r  r   r   )rP   re   r   has_urls       rB   hasurlz	FS.hasurl  sD     	KKgK.  || 	G	s    22c                     t        | dd      S )z"Check if the filesystem is closed.rK   F)rF   rU   s    rB   isclosedzFS.isclosed  s     tY..rD   c                 l    	 | j                  |      j                  S # t        j                  $ r Y yw xY w)zCheck if a path maps to an existing directory.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            bool: `True` if ``path`` maps to a directory.

        Frg   r   r   r   rj   s     rB   isdirzFS.isdir  s4    	<<%,,,&& 		s    33c                 N    t        t        | j                  |            d      du S )a  Check if a directory is empty.

        A directory is considered empty when it does not contain
        any file or any directory.

        Arguments:
            path (str): A path to a directory on the filesystem.

        Returns:
            bool: `True` if the directory is empty.

        Raises:
            errors.DirectoryExpected: If ``path`` is not a directory.
            errors.ResourceNotFound: If ``path`` does not exist.

        N)nextr   r   rj   s     rB   isemptyz
FS.isempty  s$    $ Dd+,d3t;;rD   c                 n    	 | j                  |      j                   S # t        j                  $ r Y yw xY w)zCheck if a path maps to an existing file.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            bool: `True` if ``path`` maps to a file.

        Fr  rj   s     rB   isfilez	FS.isfile  s7    	||D)0000&& 		s    44c                 &    | j                  |       y)zCheck if a path maps to a symlink.

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            bool: `True` if ``path`` maps to a symlink.

        Frg   rj   s     rB   islinkz	FS.islink  s     	TrD   c                     | j                   S )af  Get a context manager that *locks* the filesystem.

        Locking a filesystem gives a thread exclusive access to it.
        Other threads will block until the threads with the lock has
        left the context manager.

        Returns:
            threading.RLock: a lock specific to the filesystem instance.

        Example:
            >>> with my_fs.lock():  # May block
            ...    # code here has exclusive access to the filesystem
            ...    pass

        It is a good idea to put a lock around any operations that you
        would like to be *atomic*. For instance if you are copying
        files, and you don't want another thread to delete or modify
        anything while the copy is in progress.

        Locking with this method is only required for code that calls
        multiple filesystem methods. Individual methods are thread safe
        already, and don't need to be locked.

        Note:
            This only locks at the Python level. There is nothing to
            prevent other processes from modifying the filesystem
            outside of the filesystem instance.

        )rM   rU   s    rB   lockzFS.lock  s    > zzrD   c                     ddl m} | j                  5  |s&| j                  |      st	        j
                  |       || || ||       ddd       y# 1 sw Y   yxY w)a  Move directory ``src_path`` to ``dst_path``.

        Arguments:
            src_path (str): Path of source directory on the filesystem.
            dst_path (str): Path to destination directory.
            create (bool): If `True`, then ``dst_path`` will be created
                if it doesn't exist already (defaults to `False`).
            preserve_time (bool): If `True`, try to preserve mtime of the
                resources (defaults to `False`).

        Raises:
            fs.errors.ResourceNotFound: if ``dst_path`` does not exist,
                and ``create`` is `False`.
            fs.errors.DirectoryExpected: if ``src_path`` or one of its
                ancestors is not a directory.

        r	   )move_dirr   N)mover  rM   r   r   r   )rP   r   r   r   r   r  s         rB   movedirz
FS.movedir-  sV    & 	#ZZ 	R$++h"7--h77T8T8=Q	R 	R 	Rs   6AAc                    | j                          | j                  5  t        j                  | |      }|D ]  }	 | j	                  ||        	 | j	                  ||       | j                  |      cddd       S # t
        j                  $ r |s Y _w xY w# t
        j                  $ r |s Y Nw xY w# 1 sw Y   yxY w)a  Make a directory, and any missing intermediate directories.

        Arguments:
            path (str): Path to directory from root.
            permissions (~fs.permissions.Permissions, optional): Initial
                permissions, or `None` to use defaults.
            recreate (bool):  If `False` (the default), attempting to
                create an existing directory will raise an error. Set
                to `True` to ignore existing directories.

        Returns:
            ~fs.subfs.SubFS: A sub-directory filesystem.

        Raises:
            fs.errors.DirectoryExists: if the path is already
                a directory, and ``recreate`` is `False`.
            fs.errors.DirectoryExpected: if one of the ancestors
                in the path is not a directory.

        )rm   N)checkrM   r   get_intermediate_dirsro   r   DirectoryExistsopendir)rP   re   rm   rn   	dir_pathsdir_paths         rB   makedirszFS.makedirsG  s    6 	

ZZ 	&33D$?I% LL{LCT{; <<%	& 	&
 -- # $
 ))   	& 	&sR   B5A=B5B#B5=BB5BB5B2/B51B22B55B>c                    |s&| j                  |      rt        j                  |      | j                  |      j                  rt        j
                  |      | j                         j                  dd      rK	 | j                  |      }| j                  |      }	 t        j                  ||       |rt        | || |       y| j                  5  | j                  |d      5 }| j!                  ||       ddd       |rt        | || |       | j#                  |       ddd       y# t        $ r Y ow xY w# t        j                  $ r Y w xY w# 1 sw Y   [xY w# 1 sw Y   yxY w)a9  Move a file from ``src_path`` to ``dst_path``.

        Arguments:
            src_path (str): A path on the filesystem to move.
            dst_path (str): A path on the filesystem where the source
                file will be written to.
            overwrite (bool): If `True`, destination path will be
                overwritten if it exists.
            preserve_time (bool): If `True`, try to preserve mtime of the
                resources (defaults to `False`).

        Raises:
            fs.errors.FileExpected: If ``src_path`` maps to a
                directory instead of a file.
            fs.errors.DestinationExists: If ``dst_path`` exists,
                and ``overwrite`` is `False`.
            fs.errors.ResourceNotFound: If a parent directory of
                ``dst_path`` does not exist.

        supports_renameFNr   )r   r   r   rg   r   FileExpectedr   getr   osrenamer   OSErrorr   rM   r   r   rv   )rP   r   r   r   r   src_sys_pathdst_sys_pathr   s           rB   r  zFS.mover  sG   , T[[2**844<<!((%%h//<<>/7#x8#x8IIlL9 %*44JZZ 	"8T* 1iHi01 "44BKK!	" 	"   ## 1 1	" 	"sH   :"D7 D( E#E6)E(	D43D47EEE	EE%c           	          t        |       |j                  dd      }| j                  |||      }	t        j                  ||	f|||xs d||d|}
|
S )a  Open a file.

        Arguments:
            path (str): A path to a file on the filesystem.
            mode (str): Mode to open the file object with
                (defaults to *r*).
            buffering (int): Buffering policy (-1 to use
                default buffering, 0 to disable buffering, 1 to select
                line buffering, of any positive integer to indicate
                a buffer size).
            encoding (str): Encoding for text files (defaults to
                ``utf-8``)
            errors (str, optional): What to do with unicode decode errors
                (see `codecs` module for more information).
            newline (str): Newline parameter.
            **options: keyword arguments for any additional information
                required by the filesystem (if any).

        Returns:
            io.IOBase: a *file-like* object.

        Raises:
            fs.errors.FileExpected: If the path is not a file.
            fs.errors.FileExists: If the file exists, and *exclusive mode*
                is specified (``x`` in the mode).
            fs.errors.ResourceNotFound: If the path does not exist.

        t )rq   rr   utf-8)rq   rr   r   r   r   )r   replacert   r   make_stream)rP   re   rq   rr   r   r   r   rs   bin_modebin_file	io_streams              rB   r   zFS.open  st    N 	4 <<R(<<8y<I''	
 (	
 	
	 rD   c                     ddl m} |xs | j                  xs |}| j                  |      j                  st        j                  |       || |      S )a  Get a filesystem object for a sub-directory.

        Arguments:
            path (str): Path to a directory on the filesystem.
            factory (callable, optional): A callable that when invoked
                with an FS instance and ``path`` will return a new FS object
                representing the sub-directory contents. If no ``factory``
                is supplied then `~fs.subfs_class` will be used.

        Returns:
            ~fs.subfs.SubFS: A filesystem representing a sub-directory.

        Raises:
            fs.errors.ResourceNotFound: If ``path`` does not exist.
            fs.errors.DirectoryExpected: If ``path`` is not a directory.

        r	   r0   r   )subfsr1   subfs_classrg   r   r   r   )rP   re   factoryr1   _factorys        rB   r  z
FS.opendir  sL    0 	!7d..7%||D!((**55d##rD   c                 \   t        t        |            }| j                  5  t        j                  d      }|j                  | |      }|D ]4  \  }}|j                  r| j                  |       $| j                  |       6 |dk7  r| j                  |       ddd       y# 1 sw Y   yxY w)a  Recursively remove a directory and all its contents.

        This method is similar to `~fs.base.FS.removedir`, but will
        remove the contents of the directory if it is not empty.

        Arguments:
            dir_path (str): Path to a directory on the filesystem.

        Raises:
            fs.errors.ResourceNotFound: If ``dir_path`` does not exist.
            fs.errors.DirectoryExpected: If ``dir_path`` is not a directory.

        Caution:
            A filesystem should never delete its root folder, so
            ``FS.removetree("/")`` has different semantics: the
            contents of the root folder will be deleted, but the
            root will be untouched::

                >>> home_fs = fs.open_fs("~")
                >>> home_fs.removetree("/")
                >>> home_fs.exists("/")
                True
                >>> home_fs.isempty("/")
                True

            Combined with `~fs.base.FS.opendir`, this can be used
            to clear a directory without removing the directory
            itself::

                >>> home_fs = fs.open_fs("~")
                >>> home_fs.opendir("/Videos").removetree("/")
                >>> home_fs.exists("/Videos")
                True
                >>> home_fs.isempty("/Videos")
                True

        depth)search/N)	r   r   rM   r   r   rz   r   rx   rv   )rP   r!  	_dir_pathwalkergen_info_pathrz   s          rB   
removetreezFS.removetree  s    N HX./	ZZ 		)[[0F{{43H' 't;;NN5)KK&	'
 Cx(		) 		) 		)s   A8B""B+c                      xs dt        t        |             fd j                  |      D        }t        |      }||\  }}t	        j
                  |||      }|S )aJ  Get an iterator of resource info.

        Arguments:
            path (str): A path to a directory on the filesystem.
            namespaces (list, optional): A list of namespaces to include
                in the resource information, e.g. ``['basic', 'access']``.
            page (tuple, optional): May be a tuple of ``(<start>, <end>)``
                indexes to return an iterator of a subset of the resource
                info, or `None` to iterate over the entire directory.
                Paging a directory scan may be necessary for very large
                directories.

        Returns:
            ~collections.abc.Iterator: an iterator of `Info` objects.

        Raises:
            fs.errors.DirectoryExpected: If ``path`` is not a directory.
            fs.errors.ResourceNotFound: If ``path`` does not exist.

        rX   c              3   X   K   | ]!  }j                  t        |              # yw)r   N)rg   r   )r   r   rA  rf   rP   s     rB   r   zFS.scandir.<locals>.<genexpr>J  s-      
 LLeT*zLB
s   '*)r   r   rk   r   r   r   )	rP   re   rf   r   rz   r   r   r   rA  s	   ` `     @rB   r   z
FS.scandir,  si    6  %2
'
T*
 J	JE3!((E3?IrD   c                     t        |t              st        d      t        | j	                  |d            5 }|j                  |       ddd       y# 1 sw Y   yxY w)zCopy binary data to a file.

        Arguments:
            path (str): Destination path on the filesystem.
            contents (bytes): Data to be written.

        Raises:
            TypeError: if contents is not bytes.

        zcontents must be bytesr   r   N)r~   r   r   r   r   r   )rP   re   r   
write_files       rB   
writebyteszFS.writebytesT  sT     (E*455TYYt$Y/0 	'JX&	' 	' 	's   AAsetbytesc                     | j                   5   | j                  |fddi|5 }t        j                  |||       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)aU  Set a file to the contents of a binary file object.

        This method copies bytes from an open binary file to a file on
        the filesystem. If the destination exists, it will first be
        truncated.

        Arguments:
            path (str): A path on the filesystem.
            file (io.IOBase): a file object open for reading in
                binary mode.
            chunk_size (int, optional): Number of bytes to read at a
                time, if a simple copy is used, or `None` to use
                sensible default.
            **options: Implementation specific options required to open
                the source file.

        Raises:
            fs.errors.ResourceNotFound: If a parent directory of
                ``path`` does not exist.

        Note that the file object ``file`` will *not* be closed by this
        method. Take care to close it after this method completes
        (ideally with a context manager).

        Example:
            >>> with open('~/movies/starwars.mov', 'rb') as read_file:
            ...     my_fs.upload('starwars.mov', read_file)

        rq   r   r   Nr   )rP   re   r   r   rs   dst_files         rB   r   z	FS.uploadh  so    > ZZ 	Ld999 LX$$T8
KL	L 	LL L	L 	Ls!   AAAA	AA"
setbinfilec                     |dnd}| j                   5  | j                  |||||      5 }t        j                  ||       ddd       ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)a*  Set a file to the contents of a file object.

        Arguments:
            path (str): A path on the filesystem.
            file (io.IOBase): A file object open for reading.
            encoding (str, optional): Encoding of destination file,
                defaults to `None` for binary.
            errors (str, optional): How encoding errors should be treated
                (same as `io.open`).
            newline (str): Newline parameter (same as `io.open`).

        This method is similar to `~FS.upload`, in that it copies data from a
        file-like object to a resource on the filesystem, but unlike ``upload``,
        this method also supports creating files in text-mode (if the ``encoding``
        argument is supplied).

        Note that the file object ``file`` will *not* be closed by this
        method. Take care to close it after this method completes
        (ideally with a context manager).

        Example:
            >>> with open('myfile.txt') as read_file:
            ...     my_fs.writefile('myfile.txt', read_file)

        Nr   wtr   )rM   r   r   r   )rP   re   r   r   r   r   rq   rJ  s           rB   	writefilezFS.writefile  sv    D  'tTZZ 	54(67   5$$T845	5 	55 5	5 	5s"   AAAA	AA'setfilec                     i }d|i}|t        j                          n
t        |      |d<   ||d   n
t        |      |d<   | j                  ||       y)a  Set the accessed and modified time on a resource.

        Arguments:
            path: A path to a resource on the filesystem.
            accessed (datetime, optional): The accessed time, or
                `None` (the default) to use the current time.
            modified (datetime, optional): The modified time, or
                `None` (the default) to use the same time as the
                ``accessed`` parameter.

        r   Naccessedr   )timer   r{   )rP   re   rQ  r   r   raw_infos         rB   settimeszFS.settimes  sf     w' $+DIIK1B81L 	

 $,#3GJ9J89T 	
 	T8$rD   c           	          t        |t        j                        st        d      t	        | j                  |d|||            5 }|j                  |       ddd       y# 1 sw Y   yxY w)a  Create or replace a file with text.

        Arguments:
            path (str): Destination path on the filesystem.
            contents (str): Text to be written.
            encoding (str, optional): Encoding of destination file
                (defaults to ``'utf-8'``).
            errors (str, optional): How encoding errors should be treated
                (same as `io.open`).
            newline (str): Newline parameter (same as `io.open`).

        Raises:
            TypeError: if ``contents`` is not a unicode string.

        zcontents must be unicoderM  r   N)r~   r   r   r   r   r   r   )rP   re   r   r   r   r   rF  s          rB   	writetextzFS.writetext  sj    0 (CMM2677II4(67  
 	' X&	' 	' 	's   A  A)settextc                     | j                   5  t        j                         }| j                  |      sd||di}| j                  ||       ddd       y# 1 sw Y   yxY w)a[  Touch a file on the filesystem.

        Touching a file means creating a new file if ``path`` doesn't
        exist, or update accessed and modified times if the path does
        exist. This method is similar to the linux command of the same
        name.

        Arguments:
            path (str): A path to a file on the filesystem.

        r   )rQ  r   N)rM   rR  r   r{   )rP   re   nowrS  s       rB   touchzFS.touch  sT     ZZ 	-))+C;;t$%CS'IJT8,		- 	- 	-s   ?AAc                    | j                          t        |t              r!t        t        j
                  rd      d      | j                         }t        j                  t        j                  |j                  d            }|r/t        |      j                  |      rt        j                  |      t        j                  t        |j                  dd            }|dk7  rK	 | j!                  |      }t#        |      |kD  r+d}|j%                  |      }t        j&                  ||      t+        t-        |            }|S # t        j(                  $ r Y +w xY w)	a  Validate a path, returning a normalized absolute path on sucess.

        Many filesystems have restrictions on the format of paths they
        support. This method will check that ``path`` is valid on the
        underlaying storage mechanism and throw a
        `~fs.errors.InvalidPath` exception if it is not.

        Arguments:
            path (str): A path.

        Returns:
            str: A normalized, absolute path.

        Raises:
            fs.errors.InvalidPath: If the path is invalid.
            fs.errors.FilesystemClosed: if the filesystem is closed.
            fs.errors.InvalidCharsInPath: If the path contains
                invalid characters.

        zpaths must be unicode (not str)zpaths must be str (not bytes)invalid_path_charsmax_sys_path_lengthz6path too long (max {max_chars} characters in sys path))	max_chars)msg)r  r~   r   r   r   PY2r   typingcastr   r&  setintersectionr   InvalidCharsInPathintr   lenr;   InvalidPathr   r   r   )rP   re   r   invalid_charsr]  sys_path_msgr`  s           rB   validatepathzFS.validatepath	  s-   , 	

dE"77 2  5  ||~CMM488<P3QR4y%%m4//55$kk#txx8Mr/RS"$<??40 x=#66SD++0C+DC ,,Ts;;x~& ## s   &E EEc                 ^    t        j                  dt               | j                  |dg      S )a  Get the *basic* resource info.

        This method is shorthand for the following::

            fs.getinfo(path, namespaces=['basic'])

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            ~fs.info.Info: Resource information object for ``path``.

        Note:
            .. deprecated:: 2.4.13
                Please use `~FS.getinfo` directly, which is
                required to always return the *basic* namespace.

        z;method 'getbasic' has been deprecated, please use 'getinfo'basicr   )r9   r:   r=   rg   rj   s     rB   getbasiczFS.getbasicB  s-    ( 	I	
 ||DgY|77rD   c                 *    | j                  |dg      S )a3  Get the *details* resource info.

        This method is shorthand for the following::

            fs.getinfo(path, namespaces=['details'])

        Arguments:
            path (str): A path on the filesystem.

        Returns:
            ~fs.info.Info: Resource information object for ``path``.

        r   r   r  rj   s     rB   r   zFS.getdetails\  s     ||Di[|99rD   c                 L    | j                         rt        j                         y)zCheck if a filesystem may be used.

        Raises:
            fs.errors.FilesystemClosed: if the filesystem is closed.

        N)r	  r   FilesystemClosedrU   s    rB   r  zFS.checkm  s!     ==?))++ rD   c                     |yt        |t        j                        rt        d      t	        j
                  t        | j                         j                  dd             }t        j                  ||      } ||      S )a*  Check if a name matches any of a list of wildcards.

        If a filesystem is case *insensitive* (such as Windows) then
        this method will perform a case insensitive match (i.e. ``*.py``
        will match the same names as ``*.PY``). Otherwise the match will
        be case sensitive (``*.py`` and ``*.PY`` will match different
        names).

        Arguments:
            patterns (list, optional): A list of patterns, e.g.
                ``['*.py']``, or `None` to match everything.
            name (str): A file or directory name (not a path)

        Returns:
            bool: `True` if ``name`` matches any of the patterns.

        Raises:
            TypeError: If ``patterns`` is a single string instead of
                a list (or `None`).

        Example:
            >>> my_fs.match(['*.py'], '__init__.py')
            True
            >>> my_fs.match(['*.jpg', '*.png'], 'foo.gif')
            False

        Note:
            If ``patterns`` is `None` (or ``['*']``), then this
            method will always return `True`.

        Tz#patterns must be a list or sequencecase_insensitiveF)r~   r   r   r   rb  rc  boolr   r&  r   get_matcher)rP   r   r   case_sensitivematchers        rB   r   zFS.matchx  sr    B h.ABB#[[$,,.$$%7?
 
 &&x@t}rD   c                 "    ddl m}  || fi | y)a  Render a tree view of the filesystem to stdout or a file.

        The parameters are passed to :func:`~fs.tree.render`.

        Keyword Arguments:
            path (str): The path of the directory to start rendering
                from (defaults to root folder, i.e. ``'/'``).
            file (io.IOBase): An open file-like object to render the
                tree, or `None` for stdout.
            encoding (str): Unicode encoding, or `None` to
                auto-detect.
            max_levels (int): Maximum number of levels to
                display, or `None` for no maximum.
            with_color (bool): Enable terminal color output,
                or `None` to auto-detect terminal.
            dirs_first (bool): Show directories first.
            exclude (list): Option list of directory patterns
                to exclude from the tree render.
            filter (list): Optional list of files patterns to
                match in the tree render.

        r	   )renderN)treer{  )rP   r?   r{  s      rB   r|  zFS.tree  s    0 	!tvrD   c                    | j                  |       	 t        j                  |      }| j                  |      5 }	 |j                  d      }|sn|j                  |       &	 ddd       |j                         S # t        $ r% t	        j
                  dj                  |            w xY w# 1 sw Y   |j                         S xY w)a*  Get the hash of a file's contents.

        Arguments:
            path(str): A path on the filesystem.
            name(str):
                One of the algorithms supported by the `hashlib` module,
                e.g. `"md5"` or `"sha256"`.

        Returns:
            str: The hex digest of the hash.

        Raises:
            fs.errors.UnsupportedHash: If the requested hash is not supported.
            fs.errors.ResourceNotFound: If ``path`` does not exist.
            fs.errors.FileExpected: If ``path`` exists but is not a file.

        zhash '{}' is not supportedi   N)rm  hashlibnew
ValueErrorr   UnsupportedHashr;   rt   r   update	hexdigest)rP   re   r   hash_objectbinary_filechunks         rB   hashzFS.hash  s    & 	$	T!++d+K \\$ 	*;#((5""5)	  		* $$&&  	T(()E)L)LT)RSS	T	* $$&&s   A: (B+:.B(+Cr   )NF)rr^  )r/  Nr.  )FF)F)NNNNNN)NNr.  )r   )r   )r  r^  NNr.  )NN)Pr<   
__module____qualname__rE   r   r   rb   r7  rO   rV   rY   r^   propertyr`   r   abcabstractmethodrg   rk   ro   rt   rv   rx   r{   r   r   rT   r
   r   r   r   r   r   r   rH   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r	  r  r  r  r  r  r  r"  r  r   r  rB  r   rG  rH  r   rK  rN  rO  rT  rV  rW  rZ  rm  rp  r   r  r   r|  r  __classcell__)rQ   s   @rB   r4   r4   `   s   $ E L K#
 " " , , 	 ( 	 ( 	 	 2 	 	   D 	  	 ( 	 >(2 (B8 !CN W@0.* Ob& J/HMB ),G
 @ ),GC"4l0$*L:'R*,$(/
 <( BR: 	)&V/"h 4r $@1)l 	&P'$ Z0H!LF 6<0J (5T 	9-G%< 'B 	9-G-&2r84:"	,)V8'rD   )NrE   
__future__r   r   r   rb  r  r~  r   r'  r   rL   rR  r9   
contextlibr   	functoolsr   r   r.  r
   r   r   r   r   r   r   r   r`   r   rq   r   re   r   r   r   r   r   TYPE_CHECKINGr   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   typesr+   enumsr,   rz   r-   r.   rm   r/   r6  r1   r2   TypeVarr3   r6   _OpendirFactory__all__rH   add_metaclassABCMetaobjectr4   rX   rD   rB   <module>r     s   I H  
   	 
     $ D D D $  $ ) ) # 	    $ "###(!	D	)B	D	)BDz5945O &6 3;;|' |'  |'rD   