
    Ngo                     >   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 d dlmZ d dlmZmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ d dl Z d dl!m"Z" d dl#m$Z$m%Z% d d	l&m'Z' d d
l(m)Z) g dZ*d#dee+         de+fdZ,de+fdZ- G d dej.                  Z/ G d de)          Z0 G d de$          Z1 G d de1          Z2 G d de1          Z3 G d de3          Z4 G d d          Z5	  G d d           Z6	 e67                    d!"          a8dS )$    N)OrderedDict)IOBase)TracebackType)AnyCallableDictIOIterableIteratorListMutableMappingOptionalSetTypeTypeVarUnion)urlparse)download)EventLoggerVTYPE)NonBlockingIOManager)Protocol)LazyPathPathManagerget_cache_dir	file_lock	cache_dirreturnc                    | 2t           j                            t          j        dd                    } 	 t                              |            t          j        | t           j                  sJ n~# t          t          f$ rj t           j        
                    t          j                    d          }t          j        t                    }|                    |  d| d           |} Y nw xY w| S )aS  
    Returns a default directory to cache static files
    (usually downloaded from Internet), if None is provided.

    Args:
        cache_dir (None or str): if not None, will be returned as is.
            If None, returns the default cache directory as:

        1) $FVCORE_CACHE, if set
        2) otherwise ~/.torch/iopath_cache
    NFVCORE_CACHEz~/.torch/iopath_cacheiopath_cachez is not accessible! Using z	 instead!)ospath
expandusergetenv	g_pathmgrmkdirsaccessW_OKOSErrorAssertionErrorjointempfile
gettempdirlogging	getLogger__name__warning)r   tmp_dirloggers      Q/var/www/html/ai-engine/env/lib/python3.11/site-packages/iopath/common/file_io.pyr   r   *   s     G&&In&=>>
 
	###yBG,,,,,,^$   ',,x244nEE"8,,)QQwQQQRRR				
 s   ;A2 2A8C-,C-r#   c                     t           j                            |           }	 t          j        |d           n# t          $ r Y nw xY wt          j        | dz   d          S )a!  
    A file lock. Once entered, it is guaranteed that no one else holds the
    same lock. Others trying to enter the lock will block for 30 minutes and
    raise an exception.

    This is useful to make sure workers don't cache files to the same location.

    Args:
        path (str): a path to be locked. This function will create a lock named
            `path + ".lock"`

    Examples:

        filename = "/path/to/file"
        with file_lock(filename):
            if not os.path.isfile(filename):
                do_create_file()
    Texist_okz.locki  )timeout)r"   r#   dirnamemakedirsr*   portalockerLock)r#   r:   s     r5   r   r   E   sr    & good##G
Gd+++++    	 D7ND9999s   8 
AAc                   ~     e Zd ZdZddgZdeg ef         ddfdZdefdZdefd	Z	d
ef fdZ
d Zdef fdZ xZS )r   a=  
    A path that's lazily evaluated when it's used.

    Users should be careful to not use it like a str, because
    it behaves differently from a str.
    Path manipulation functions in Python such as `os.path.*` all accept
    PathLike objects already.

    It can be materialized to a str using `os.fspath`.
    __getstate____setstate__funcr   Nc                 "    || _         d| _        dS )z
        Args:
            func: a function that takes no arguments and returns the
                actual path as a str. It will be called at most once.
        N)_func_value)selfrA   s     r5   __init__zLazyPath.__init__t   s     
%)    c                 P    | j         |                                 | _         | j         S N)rD   rC   rE   s    r5   
_get_valuezLazyPath._get_value}   s!    ;**,,DK{rG   c                 *    |                                  S rI   )rK   rJ   s    r5   
__fspath__zLazyPath.__fspath__   s       rG   namec                     |t           j        v r!t                                          |          S | j        t          d| d          t          | j        |          S )Nz)Uninitialized LazyPath has no attribute: .)r   KEPT_ATTRIBUTESsuper__getattr__rD   AttributeErrorgetattr)rE   rN   	__class__s     r5   rS   zLazyPath.__getattr__   s]    8+++77&&t,,,; !TT!T!T!TUUUt{D)))rG   c                 H    | j         t          d          | j         |         S )Nz,Uninitialized LazyPath is not subscriptable.)rD   	TypeError)rE   keys     r5   __getitem__zLazyPath.__getitem__   s&    ;JKKK{3rG   c                 `    | j         | j         S t                                                      S rI   )rD   rR   __str__rE   rV   s    r5   r\   zLazyPath.__str__   s'    ;";77??$$$rG   )r1   
__module____qualname____doc__rQ   r   strrF   rK   rM   rS   rZ   r\   __classcell__rV   s   @r5   r   r   f   s        	 	 &~6O*Xb#g. *4 * * * *C    
!C ! ! ! !* * * * * * *     
% % % % % % % % % % %rG   r   c                   z    e Zd ZdZd
dZdeee                  dee         dee         ddfdZ	de
e         fd	ZdS )	TabularIOzF
    Context Manager interface to be used by PathHandler methods.
    r   c                     d S rI    rJ   s    r5   	__enter__zTabularIO.__enter__       rG   exc_typeexc_valexc_tbNc                     d S rI   rg   )rE   rj   rk   rl   s       r5   __exit__zTabularIO.__exit__   s	     	rG   c                     d S rI   rg   rJ   s    r5   __iter__zTabularIO.__iter__   ri   rG   )r   re   )r1   r^   r_   r`   rh   r   r   BaseExceptionr   rn   r   r   rp   rg   rG   r5   re   re      s            4./ -( '	
 
   (3-      rG   re   c                       e Zd ZdZdZ	 d)deej        j                 ddf fdZ	de
eef         ddfdZdee         fd	Zd*dedededefdZ	 d*dededededdf
dZ	 d+dededededef
dZ	 d,dededededeee         ee         f         f
dZ	 	 	 d-dededeedgdf                  dededefdZd)dee         dedefdZdedefdZ	 d*dededededef
dZdedededefdZ dededefd Z!dededefd!Z"dededefd"Z#dededee         fd#Z$dededdfd$Z%dededdfd%Z&dedededefd&Z'deedf         dedefd'Z(dedefd(Z) xZ*S ).PathHandlerz
    PathHandler is a base class that defines common I/O functionality for a URI
    protocol. It routes I/O for a generic URI which may look like "protocol://*"
    or a canonical filepath "/foo/bar/baz".
    TNasync_executorr   c                     t                                                       d| _        || _        	 ddlm}  ||            dS # t          $ r Y dS w xY w)a.  
        When registering a `PathHandler`, the user can optionally pass in a
        `Executor` to run the asynchronous file operations.
        NOTE: For regular non-async operations of `PathManager`, there is
        no need to pass `async_executor`.

        Args:
            async_executor (optional `Executor`): Used for async file operations.
                Usage:
                ```
                    path_handler = NativePathHandler(async_executor=exe)
                    path_manager.register_handler(path_handler)
                ```
        Nr   )setup_handler_defaults)rR   rF   _non_blocking_io_manager_non_blocking_io_executoriopath.common.setup_defaultsrv   ImportError)rE   rt   rv   rV   s      r5   rF   zPathHandler.__init__   s{    $ 	(,%)7&	KKKKKK""4((((( 	 	 	DD	s   A 
AAkwargsc                 :   | j         r7t          |          dk    r"t          d                    |                    dS t	          j        t                    }|                                D ].\  }}|                    d                    ||                     /dS )a  
        Checks if the given arguments are empty. Throws a ValueError if strict
        kwargs checking is enabled and args are non-empty. If strict kwargs
        checking is disabled, only a warning is logged.

        Args:
            kwargs (Dict[str, Any])
        r   zUnused arguments: {}z$[PathManager] {}={} argument ignoredN)	_strict_kwargs_checklen
ValueErrorformatr/   r0   r1   itemsr2   )rE   r{   r4   kvs        r5   _check_kwargszPathHandler._check_kwargs   s     $ 	T6{{Q !7!>!>v!F!FGGG  &x00F T T1ELLQPQRRSSSST TrG   c                     t                      )zg
        Returns:
            List[str]: the list of URI prefixes this PathHandler can support
        NotImplementedErrorrJ   s    r5   _get_supported_prefixesz#PathHandler._get_supported_prefixes   s    
 "###rG   Fr#   forcec                     t                      )a  
        Get a filepath which is compatible with native Python I/O such as `open`
        and `os.path`.

        If URI points to a remote resource, this function may download and cache
        the resource to local disk. In this case, the cache stays on filesystem
        (under `file_io.get_cache_dir()`) and will be used by a different run.
        Therefore this function is meant to be used with read-only resources.

        Args:
            path (str): A URI supported by this PathHandler
            force(bool): Forces a download from backend if set to True.

        Returns:
            local_path (str): a file path which exists on the local file system
        r   rE   r#   r   r{   s       r5   _get_local_pathzPathHandler._get_local_path       " "###rG   
local_pathdst_path	overwritec                     t                      )  
        Copies a local file to the specified URI.

        If the URI is another local path, this should be functionally identical
        to copy.

        Args:
            local_path (str): a file path which exists on the local file system
            dst_path (str): A URI supported by this PathHandler
            overwrite (bool): Bool flag for forcing overwrite of existing URI

        Returns:
            status (bool): True on success
        r   rE   r   r   r   r{   s        r5   _copy_from_localzPathHandler._copy_from_local   r   rG   r    mode	bufferingc                     t                      rI   r   rE   r#   r   r   r{   s        r5   _opentzPathHandler._opent  s     "###rG   c                     t                      )  
        Open a stream to a URI, similar to the built-in `open`.

        Args:
            path (str): A URI supported by this PathHandler
            mode (str): Specifies the mode in which the file is opened. It defaults
                to 'r'.
            buffering (int): An optional integer used to set the buffering policy.
                Pass 0 to switch buffering off and an integer >= 1 to indicate the
                size in bytes of a fixed-size chunk buffer. When no buffering
                argument is given, the default buffering policy depends on the
                underlying I/O implementation.

        Returns:
            file: a file-like object.
        r   r   s        r5   _openzPathHandler._open  s    & "###rG   callback_after_file_closec                    h dt          fd|D                       st          d|           | j        st          d| j                  | _        	 | j                            |                     |           | j        ||fi |||          S # t          $ rF t          j	        t                    }|                    d           |                                  Y dS w xY w)	a  
        Open a file with asynchronous methods. `f.write()` calls will be dispatched
        asynchronously such that the main program can continue running.
        `f.read()` is an async method that has to run in an asyncio event loop.

        NOTE: Writes to the same path are serialized so they are written in
        the same order as they were called but writes to distinct paths can
        happen concurrently.

        Usage (write, default / without callback function):
            for n in range(50):
                results = run_a_large_task(n)
                # `f` is a file-like object with asynchronous methods
                with path_manager.opena(uri, "w") as f:
                    f.write(results)            # Runs in separate thread
                # Main process returns immediately and continues to next iteration
            path_manager.async_close()

        Usage (write, advanced / with callback function):
            # To asynchronously write to storage:
            def cb():
                path_manager.copy_from_local(
                    "checkpoint.pt", uri
                )
            f = pm.opena("checkpoint.pt", "wb", callback_after_file_close=cb)
            torch.save({...}, f)
            f.close()

        Usage (read):
            async def my_function():
              return await path_manager.opena(uri, "r").read()

        Args:
            ...same args as `_open`...
            callback_after_file_close (Callable): An optional argument that can
                be passed to perform operations that depend on the asynchronous
                writes being completed. The file is first written to the local
                disk and then the callback is executed.
            buffering (int): An optional argument to set the buffer size for
                buffered asynchronous writing.

        Returns:
            file: a file-like object with asynchronous methods.
        >   abwc              3       K   | ]}|v V  	d S rI   rg   ).0mvalid_modess     r5   	<genexpr>z%PathHandler._opena.<locals>.<genexpr>c  s(      221#222222rG   z.`opena` mode must be write or append for path F)bufferedexecutor)r#   io_objr   r   zAn exception occurred in `NonBlockingIOManager`. This is most likely due to invalid `opena` args. Make sure they match the `open` args for the `PathHandler`.N)allr   rw   r   rx   get_non_blocking_io_get_path_with_cwdr   r/   r0   r1   	exception_async_close)rE   r#   r   r   r   r{   r4   r   s          @r5   _openazPathHandler._opena-  s9   j &oo2222T22222 	VTdTTUUU
 , 	,@7- - -D)
	 0DD,,T22!tz$7777*C#	 E     	  	  	 
 &x00FD   	 s   =B AC$#C$c                     | j         s.t          j        t                    }|                    d           |                     |           | j                             |r|                     |          nd          S )a  
        Ensures that desired async write threads are properly joined.

        Args:
            path (str): Pass in a file path to wait until all asynchronous
                activity for that path is complete. If no path is passed in,
                then this will wait until all asynchronous jobs are complete.

        Returns:
            status (bool): True on success
        zJThis is an async feature. No threads to join because `opena` was not used.N)rw   r/   r0   r1   r2   r   _joinr   )rE   r#   r{   r4   s       r5   _async_joinzPathHandler._async_join  s     , 	&x00FNN(   	6""",22-1;D##D)))t
 
 	
rG   c                     | j         s.t          j        t                    }|                    d           |                     |           | j                                         S )z
        Closes the thread pool used for the asynchronous operations.

        Returns:
            status (bool): True on success
        zNThis is an async feature. No threadpool to close because `opena` was not used.)rw   r/   r0   r1   r2   r   _close_thread_pool)rE   r{   r4   s      r5   r   zPathHandler._async_close  se     , 	&x00FNN(   	6""",??AAArG   src_pathc                     t                      )X  
        Copies a source path to a destination path.

        Args:
            src_path (str): A URI supported by this PathHandler
            dst_path (str): A URI supported by this PathHandler
            overwrite (bool): Bool flag for forcing overwrite of existing file

        Returns:
            status (bool): True on success
        r   )rE   r   r   r   r{   s        r5   _copyzPathHandler._copy  s     "###rG   c                     t                      )  
        Moves (renames) a source path to a destination path.

        Args:
            src_path (str): A URI supported by this PathHandler
            dst_path (str): A URI supported by this PathHandler

        Returns:
            status (bool): True on success
        r   rE   r   r   r{   s       r5   _mvzPathHandler._mv  s     "###rG   c                     t                      )
        Checks if there is a resource at the given URI.

        Args:
            path (str): A URI supported by this PathHandler

        Returns:
            bool: true if the path exists
        r   rE   r#   r{   s      r5   _existszPathHandler._exists       "###rG   c                     t                      )z
        Checks if the resource at the given URI is a file.

        Args:
            path (str): A URI supported by this PathHandler

        Returns:
            bool: true if the path is a file
        r   r   s      r5   _isfilezPathHandler._isfile  r   rG   c                     t                      )
        Checks if the resource at the given URI is a directory.

        Args:
            path (str): A URI supported by this PathHandler

        Returns:
            bool: true if the path is a directory
        r   r   s      r5   _isdirzPathHandler._isdir  r   rG   c                     t                      z
        List the contents of the directory at the provided URI.

        Args:
            path (str): A URI supported by this PathHandler

        Returns:
            List[str]: list of contents in given path
        r   r   s      r5   _lszPathHandler._ls  r   rG   c                     t                      )  
        Recursive directory creation function. Like mkdir(), but makes all
        intermediate-level directories needed to contain the leaf directory.
        Similar to the native `os.makedirs`.

        Args:
            path (str): A URI supported by this PathHandler
        r   r   s      r5   _mkdirszPathHandler._mkdirs  s     "###rG   c                     t                      )
        Remove the file (not directory) at the provided URI.

        Args:
            path (str): A URI supported by this PathHandler
        r   r   s      r5   _rmzPathHandler._rm  s     "###rG   c                     t                      )z
        Symlink the src_path to the dst_path

        Args:
            src_path (str): A URI supported by this PathHandler to symlink from
            dst_path (str): A URI supported by this PathHandler to symlink to
        r   r   s       r5   _symlinkzPathHandler._symlink  s     "###rG   c                     t                      )al  
        Set the current working directory. PathHandler classes prepend the cwd
        to all URI paths that are handled.

        Args:
            path (str) or None: A URI supported by this PathHandler. Must be a valid
                absolute path or None to set the cwd to None.

        Returns:
            bool: true if cwd was set without errors
        r   r   s      r5   _set_cwdzPathHandler._set_cwd  s     "###rG   c                     |S )a5  
        Default implementation. PathHandler classes that provide a `_set_cwd`
        feature should also override this `_get_path_with_cwd` method.

        Args:
            path (str): A URI supported by this PathHandler.

        Returns:
            path (str): Full path with the cwd attached.
        rg   rE   r#   s     r5   r   zPathHandler._get_path_with_cwd%  s	     rG   rI   Fr   r   r   r   )r   Nr   )+r1   r^   r_   r`   r}   r   
concurrentfuturesExecutorrF   r   ra   r   r   r   r   boolr   r   intre   r   r   r	   bytesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   rc   s   @r5   rs   rs      s           AE  !3!<= 
     :TDcN Tt T T T T"$c $ $ $ $$ $C $ $ $PS $ $ $ $( AF$ $$),$9=$QT$	$ $ $ $( <>$ $$"$58$IL$	$ $ $ $ <>$ $$"$58$IL$	r#w5	!	"$ $ $ $0 FJV  V V  V  $,HdVT\,B#C	V 
 V  V  
V  V  V  V p
 
 
 
 
 
 
 
.BS BT B B B B" ?D$ $$'*$7;$OR$	$ $ $ $ $C $3 $# $$ $ $ $ $
$C 
$3 
$4 
$ 
$ 
$ 
$
$C 
$3 
$4 
$ 
$ 
$ 
$
$3 
$# 
$$ 
$ 
$ 
$ 
$
$ 
$s 
$tCy 
$ 
$ 
$ 
$	$C 	$3 	$4 	$ 	$ 	$ 	$$ $s $t $ $ $ $$ $ $s $t $ $ $ $$U39- $ $ $ $ $ $s s        rG   rs   c                   .    e Zd ZdZdZ	 d&deej        j                 ddf fdZ	d'de
ded	ede
fd
Z	 d'de
de
ded	eddf
dZ	 	 	 	 	 	 	 d(de
de
dedee
         dee
         dee
         dedee         d	edeee
         ee         f         fdZ	 d'de
de
ded	edef
dZde
de
d	edefdZde
de
d	edefdZde
d	edefdZde
d	edefdZde
d	edefd Zde
d	edee
         fd!Zde
d	eddfd"Zde
d	eddfd#Zdee
df         d	edefd$Zde
de
fd%Z  xZ!S ))NativePathHandlerz
    Handles paths that can be accessed using Python native system calls. This
    handler uses `open()` and `os.*` calls on the given path.
    Nrt   r   c                 J    t                                          |           d S rI   )rR   rF   )rE   rt   rV   s     r5   rF   zNativePathHandler.__init__<  s#     	(((((rG   Fr#   r   r{   c                 T    |                      |           t          j        |          S rI   )r   r"   fspathr   s       r5   r   z!NativePathHandler._get_local_pathB  s$    6"""yrG   r   r   r   c                     |                      |           |                     |          }|                     |          } | j        d|||d|sJ d S )N)r   r   r   rg   )r   r   r   r   s        r5   r   z"NativePathHandler._copy_from_localF  s     	6""",,Z88
**844tz 
(i
 
KQ
 
 	
 	
 	
 	
 	
rG   r   r   Tr   r   encodingerrorsnewlineclosefdopenerc	           
          |                      |	           t          |                     |          |||||||          S )u  
        Open a path.

        Args:
            path (str): A URI supported by this PathHandler
            mode (str): Specifies the mode in which the file is opened. It defaults
                to 'r'.
            buffering (int): An optional integer used to set the buffering policy.
                Pass 0 to switch buffering off and an integer >= 1 to indicate the
                size in bytes of a fixed-size chunk buffer. When no buffering
                argument is given, the default buffering policy works as follows:
                    * Binary files are buffered in fixed-size chunks; the size of
                    the buffer is chosen using a heuristic trying to determine the
                    underlying device’s “block size” and falling back on
                    io.DEFAULT_BUFFER_SIZE. On many systems, the buffer will
                    typically be 4096 or 8192 bytes long.
            encoding (Optional[str]): the name of the encoding used to decode or
                encode the file. This should only be used in text mode.
            errors (Optional[str]): an optional string that specifies how encoding
                and decoding errors are to be handled. This cannot be used in binary
                mode.
            newline (Optional[str]): controls how universal newlines mode works
                (it only applies to text mode). It can be None, '', '
', '',
                and '
'.
            closefd (bool): If closefd is False and a file descriptor rather than
                a filename was given, the underlying file descriptor will be kept
                open when the file is closed. If a filename is given closefd must
                be True (the default) otherwise an error will be raised.
            opener (Optional[Callable]): A custom opener can be used by passing
                a callable as opener. The underlying file descriptor for the file
                object is then obtained by calling opener with (file, flags).
                opener must return an open file descriptor (passing os.open as opener
                results in functionality similar to passing None).

            See https://docs.python.org/3/library/functions.html#open for details.

        Returns:
            file: a file-like object.
        )r   r   r   r   r   r   )r   openr   )
rE   r#   r   r   r   r   r   r   r   r{   s
             r5   r   zNativePathHandler._openP  sV    h 	6"""##D))	
 	
 	
 		
rG   r   c                 D   |                      |           |                     |          }|                     |          }t          j                            |          rE|sCt          j        t                    }|                    d	                    |                     dS 	 t          j        ||           dS # t          $ rY}t          j        t                    }|                    d	                    t          |                               Y d}~dS d}~ww xY w)r   #Destination file {} already exists.FTzError in file copy - {}N)r   r   r"   r#   existsr/   r0   r1   errorr   shutilcopyfile	Exceptionra   )rE   r   r   r   r{   r4   es          r5   r   zNativePathHandler._copy  s    	6"""**844**8447>>(## 	I 	&x00FLL>EEhOOPPP5	OHh///4 	 	 	&x00FLL299#a&&AABBB55555	s   %B< <
DADDc                 @   |                      |           |                     |          }|                     |          }t          j                            |          rCt          j        t                    }|                    d	                    |                     dS 	 t          j        ||           dS # t          $ rY}t          j        t                    }|                    d	                    t          |                               Y d}~dS d}~ww xY w)r   r   FTzError in move operation - {}N)r   r   r"   r#   r   r/   r0   r1   r   r   r   mover   ra   rE   r   r   r{   r4   r   s         r5   r   zNativePathHandler._mv  s	    	6"""**844**8447>>(## 	&x00FLL>EEhOOPPP5	K(+++4 	 	 	&x00FLL7>>s1vvFFGGG55555	s   #B: :
DADDc                    |                      |           |                     |          }|                     |          }t          j        t                    }t
          j                            |          s*|                    d	                    |                     dS t
          j                            |          r*|                    d	                    |                     dS 	 t          j
        ||           dS # t          $ r@}|                    d	                    t          |                               Y d}~dS d}~ww xY w)a  
        Creates a symlink to the src_path at the dst_path

        Args:
            src_path (str): A URI supported by this PathHandler
            dst_path (str): A URI supported by this PathHandler

        Returns:
            status (bool): True on success
        zSource path {} does not existFz#Destination path {} already exists.TzError in symlink - {}N)r   r   r/   r0   r1   r"   r#   r   r   r   symlinkr   ra   r   s         r5   r   zNativePathHandler._symlink  s5    	6"""**844**844"8,,w~~h'' 	LL8??IIJJJ57>>(## 	LL>EEhOOPPP5	Jx***4 	 	 	LL077A??@@@55555	s   ,D 
E5EEc                     |                      |           t          j                            |                     |                    S rI   )r   r"   r#   r   r   r   s      r5   r   zNativePathHandler._exists  8    6"""w~~d55d;;<<<rG   c                     |                      |           t          j                            |                     |                    S rI   )r   r"   r#   isfiler   r   s      r5   r   zNativePathHandler._isfile  r   rG   c                     |                      |           t          j                            |                     |                    S rI   )r   r"   r#   isdirr   r   s      r5   r   zNativePathHandler._isdir  s8    6"""w}}T44T::;;;rG   c                 z    |                      |           t          j        |                     |                    S rI   )r   r"   listdirr   r   s      r5   r   zNativePathHandler._ls  s4    6"""z$11$77888rG   c                     |                      |           	 t          j        |d           d S # t          $ r!}|j        t          j        k    r Y d }~d S d }~ww xY w)NTr7   )r   r"   r;   r*   errnoEEXIST)rE   r#   r{   r   s       r5   r   zNativePathHandler._mkdirs  s{    6"""	Kt,,,,,, 	 	 	w%,&& '&&&&&	s   / 
AAAc                 X    |                      |           t          j        |           d S rI   )r   r"   remover   s      r5   r   zNativePathHandler._rm  s'    6"""
	$rG   c                    |                      |           |	d | _        dS t          j                            |          st          | d          t          j                            |          st          | d          || _        dS )NTz is not a valid Unix pathz is not an absolute path)r   _cwdr"   r#   r   r   isabsr   s      r5   r   zNativePathHandler._set_cwd  s    6"""<DI4 w~~d## 	A???@@@w}}T"" 	@>>>???	trG   c                     |s|S t           j                            | j        s|n$t           j                            | j        |                    S rI   )r"   r#   normpathr
  r,   r   s     r5   r   z$NativePathHandler._get_path_with_cwd  sI     	Kw	DDDrw||DIt'D'D
 
 	
rG   rI   r   )r   r   NNNTN)"r1   r^   r_   r`   r
  r   r   r   r   rF   ra   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   rc   s   @r5   r   r   3  s         D AE) ) !3!<=) 
) ) ) ) ) ) C   PS    
 AF
 

),
9=
QT
	
 
 
 
 "& $!%%)>
 >
>
 >
 	>

 3->
 >
 #>
 >
 ">
 >
 
r#w5	!	">
 >
 >
 >
B ?D '*7;OR	   <C 3 # $    6  s t    8=C =3 =4 = = = ==C =3 =4 = = = =<3 <# <$ < < < <9 9s 9tCy 9 9 9 9C 3 4     s t    U39-       
s 
s 
 
 
 
 
 
 
 
rG   r   c                        e Zd ZdZdZd fdZdee         fdZ	 	 dded	e	d
e
e         dedef
dZ	 ddededededeee         ee         f         f
dZ xZS )HTTPURLHandlerz/
    Download URLs and cache them to disk.
       r   Nc                 V    t                                                       i | _        d S rI   )rR   rF   	cache_mapr]   s    r5   rF   zHTTPURLHandler.__init__!  s$    )+rG   c                 
    g dS )N)zhttp://zhttps://zftp://rg   rJ   s    r5   r   z&HTTPURLHandler._get_supported_prefixes%  s    0000rG   Fr#   r   r   r{   c                    |                      |           |s4|| j        vs+t          j                            | j        |                   st          j        t                    }t          |          }t          j        	                    t          |          t          j                            |j                            d                              }|                    d          d         }t          |          | j        k    r&|dd         dz   t!          j                    j        z   }t          j        	                    ||          }	t'          |	          5  t          j                            |	          s:|                    d                    |                     t/          |||          }	ddd           n# 1 swxY w Y   |                    d                    ||	                     |	| j        |<   | j        |         S )	
        This implementation downloads the remote resource and caches it locally.
        The resource will only be downloaded if not previously requested.
        /r   Nd   _zDownloading {} ...)filenamezURL {} cached in {})r   r  r"   r#   r   r/   r0   r1   r   r,   r   r:   lstripsplitr~   MAX_FILENAME_LENuuiduuid4hexr   r   infor   r   )
rE   r#   r   r   r{   r4   
parsed_urlr:   r  cacheds
             r5   r   zHTTPURLHandler._get_local_path(  s    	6"""	*4>))7>>$."677 * &x00F!$Jglli(("'//*/:P:PQT:U:U*V*V G zz#r*H8}}t444#DSD>C/$*,,2BBW\\'844F6"" H Hw~~f-- HKK 4 ; ;D A ABBB%dGhGGGFH H H H H H H H H H H H H H H KK-44T6BBCCC#)DN4 ~d##s   AGGGr   r   r   r   c                    |                      |           |dv s(J d                    | j        j        |                      |dk    sJ | j        j         d            |                     |d          }t          ||          S )a  
        Open a remote HTTP path. The resource is first downloaded and cached
        locally.

        Args:
            path (str): A URI supported by this PathHandler
            mode (str): Specifies the mode in which the file is opened. It defaults
                to 'r'.
            buffering (int): Not used for this PathHandler.

        Returns:
            file: a file-like object.
        )r   rbz%{} does not support open with {} moder   z* does not support the `buffering` argumentF)r   )r   r   rV   r1   r   r   )rE   r#   r   r   r{   r   s         r5   r   zHTTPURLHandler._openK  s      	6"""{"""$K$R$RN#T%
 %
""" OOOn%QQQ OO))$e)<<
J%%%rG   r   N)FNr   )r1   r^   r_   r`   r  rF   r   ra   r   r   r   r   r   r   r   r	   r   r   rb   rc   s   @r5   r  r    s         , , , , , ,1c 1 1 1 1 #'	!$ !$!$ !$ C=	!$
 !$ 
!$ !$ !$ !$H <>& &&"&58&IL&	r#w5	!	"& & & & & & & &rG   r  c            	       b     e Zd ZdZdZdedefdZdee         fdZdded	e	d
e
def fdZ xZS )OneDrivePathHandlerz<
    Map OneDrive (short) URLs to direct download links
    zhttps://1drv.ms/u/s!one_drive_urlr   c                     t          j        t          |d                    }|                    d                              dd                              dd                              d          }d| d}|S )	a  
        Converts a short OneDrive URI into a download link that can be used with wget

        Args:
            one_drive_url (str): A OneDrive URI supported by this PathHandler

        Returns:
            result_url (str): A direct download URI for the file
        zutf-8r  r  +-=z'https://api.onedrive.com/v1.0/shares/u!z/root/content)base64	b64encoder   decodereplacerstrip)rE   r(  data_b64data_b64_string
result_urls        r5    create_one_drive_direct_downloadz4OneDrivePathHandler.create_one_drive_direct_downloadm  s     #E-$A$ABBOOG$$,,S#66>>sCHHOOPSTT 	 UoTTT 	 rG   c                     | j         gS rI   )ONE_DRIVE_PREFIXrJ   s    r5   r   z+OneDrivePathHandler._get_supported_prefixes  s    %&&rG   Fr#   r   r{   c                     t          j        t                    }|                     |          }|                    d| d|             t                      j        t          j        |          fd|i|S )r  zURL z  mapped to direct download link r   )	r/   r0   r1   r5  r   rR   r   r"   r   )rE   r#   r   r{   r4   
direct_urlrV   s         r5   r   z#OneDrivePathHandler._get_local_path  sy    
 "8,,::4@@
M4MMMMNNN&uww&ry'<'<TTETVTTTrG   r   )r1   r^   r_   r`   r7  ra   r5  r   r   r   r   r   rb   rc   s   @r5   r'  r'  f  s          .c c    &'c ' ' ' '

U 
UC 
U 
U 
UPS 
U 
U 
U 
U 
U 
U 
U 
U 
U 
UrG   r'  c                      e Zd ZdZd1dZdeeej        f         de	fdZ
de	deeef         ddfd	Zded
ededeeef         fdZ	 d2ded
edededef
dZ	 d3ded
edededeee         ee         f         f
dZ	 	 	 d4ded
ededeedgdf                  dedefdZdededefdZdedefdZ	 d5dededededef
dZdedededefdZd5dedededefdZ	 d5d ededededef
d!Z dededefd"Z!dededefd#Z"dededefd$Z#dedede$e         fd%Z%dededdfd&Z&dededdfd'Z'dedededefd(Z(deedf         dedefd)Z)	 d6de	d+eddfd,Z*d-eddfd.Z+d6d/Z,dededededef
d0Z-dS )7r   a  
    A class for users to open generic paths or translate generic paths to file names.

    path_manager.method(path) will do the following:
    1. Find a handler by checking the prefixes in `self._path_handlers`.
    2. Call handler.method(path) on the handler that's found
    r   Nc                     t                      | _        	 t                      | _        	 d | _        	 t                      | _        	 d| _        d S )NT)r   _path_handlersr   _native_path_handlerr
  set_async_handlers_enable_loggingrJ   s    r5   rF   zPathManager.__init__  s^    @K	 2C1D1D!	 $(		
 25	  $	 	rG   r#   c                     t          j        |          }| j                                        D ]&}|                    |          r| j        |         c S '| j        S )a  
        Finds a PathHandler that supports the given path. Falls back to the native
        PathHandler if no other handler is found.

        Args:
            path (str or os.PathLike): URI path to resource

        Returns:
            handler (PathHandler)
        )r"   r   r<  keys
startswithr=  )rE   r#   ps      r5   __get_path_handlerzPathManager.__get_path_handler  se     y$))++ 	. 	.Aq!! .*1----.((rG   handlerkvsc                 H   | j         r|                    |           |                    dt          |          j                   	 |                                 dS # t          $ r9 t          j        t                    }|	                    d           d| _         Y dS w xY wdS )z
        Logs a dictionary of key-value pairs to a given path handler.

        Args:
            handler (PathHandler): The path handler to send the key-value pairs to.
            kvs (Dict): Dict of Key-value pairs to be logged.

        rF  z]An exception occurred in telemetry logging.Disabling telemetry to prevent further exceptions.FN)
r@  add_keysadd_keytyper1   	log_eventr   r/   r0   r   )rE   rF  rG  r4   s       r5   __log_tmetry_keyszPathManager.__log_tmetry_keys  s      	-S!!!OOItG}}'=>>>-!!##### - - - *844  I   (-$$$$-	- 	-s   A ?BBr   r   c                     i }d|d<   d|v rd|d<   nd|v rd|d<   n	d|v rd	|d<   ||d
<   d|v rd|d<   nd|d<   ||d<   |S )z
        Helper function to return common set of key-value pairs applicable to open apis.

        Args:
            path (str):
            mode (str):
            buffering (int):

        r   opr   readr   r   writer   appendr   r   binaryr   textr#   rg   )rE   r#   r   r   rG  s        r5   __get_open_keyszPathManager.__get_open_keys  s     D	$;; CKKD[[!CKKD[["CK$K$;;$CMM"CMF
rG   r   r   r{   c                 H     |                      |          j        |||fi |S )a  
        Open a tabular data source. Only reading is supported.
        The opent() returns a Python iterable collection object, compared to bytes/text data with open()

        Args:
            path (str): A URI supported by this PathHandler
            mode (str): Specifies the mode in which the file is opened. It defaults
                to 'r'
            buffering (int): number of rows fetched and cached

        Returns:
            A TabularIO context manager object
        )_PathManager__get_path_handlerr   r   s        r5   opentzPathManager.opent  s1      4t&&t,,3D$	TTVTTTrG   r   c                     |                      |          }|                    | j                    |j        ||fd|i|}|                     |||          }|                     ||           |S )r   r   )rW  set_loggingr@  r   _PathManager__get_open_keys_PathManager__log_tmetry_keys)rE   r#   r   r   r{   rF  bretrG  s           r5   r   zPathManager.open  s    & ))$// 	D0111w}T4GG9GGG""4y99w,,,rG   r   c                     d|v r
||d<   ||d<    |                      |          j        ||fi |}d|v r-| j                            |                      |                     |S )a  
        Open a file with asynchronous methods. `f.write()` calls will be dispatched
        asynchronously such that the main program can continue running.
        `f.read()` is an async method that has to run in an asyncio event loop.

        NOTE: Writes to the same path are serialized so they are written in
        the same order as they were called but writes to distinct paths can
        happen concurrently.

        Usage (write, default / without callback function):
            for n in range(50):
                results = run_a_large_task(n)
                # `f` is a file-like object with asynchronous methods
                with path_manager.opena(uri, "w") as f:
                    f.write(results)            # Runs in separate thread
                # Main process returns immediately and continues to next iteration
            path_manager.async_close()

        Usage (write, advanced / with callback function):
            # To asynchronously write to storage:
            def cb():
                path_manager.copy_from_local("checkpoint.pt", uri)
            f = pm.opena("checkpoint.pt", "wb", callback_after_file_close=cb)
            torch.save({...}, f)
            f.close()

        Usage (read):
            async def my_function():
              return await path_manager.opena(uri, "r").read()

        Args:
            ...
            callback_after_file_close (Callable): Only used in write mode. An
                optional argument that can be passed to perform operations that
                depend on the asynchronous writes being completed. The file is
                first written to the local disk and then the callback is
                executed.

        Returns:
            file: a file-like object with asynchronous methods.
        r   r   r   )rW  r   r?  add)rE   r#   r   r   r   r{   non_blocking_ios          r5   openazPathManager.opena,  s    b $;;2KF./"+F;>$11$77>
 
 
 

 $;;  $$T%<%<T%B%BCCCrG   pathsc                     d}|s| j         D ]} |j        di |o|}n(|D ]%} |                     |          j        |fi |o|}&|S )a   
        Ensures that desired async write threads are properly joined.

        Usage:
            Wait for asynchronous methods operating on specific file paths to
            complete.
                async_join("path/to/file1.txt")
                async_join("path/to/file2.txt", "path/to/file3.txt")
            Wait for all asynchronous methods to complete.
                async_join()

        Args:
            *paths (str): Pass in any number of file paths and `async_join` will wait
                until all asynchronous activity for those paths is complete. If no
                paths are passed in, then `async_join` will wait until all asynchronous
                jobs are complete.

        Returns:
            status (bool): True on success
        Trg   )r?  r   rW  )rE   rb  r{   successrF  r#   s         r5   
async_joinzPathManager.async_joink  s    *  	/ D D-'-7777CGD   =D++D11=dMMfMM    rG   c                      | j         di |}| j        D ]} |j        di |o|}| j                                         |S )a-  
        `async_close()` must be called at the very end of any script that uses the
        asynchronous `opena` feature. This calls `async_join()` first and then closes
        the thread pool used for the asynchronous operations.

        Returns:
            status (bool): True on success
        rg   )re  r?  r   clear)rE   r{   rd  rF  s       r5   async_closezPathManager.async_close  sh     "$/++F+++ 	A 	AG*g*44V44@GG""$$$rG   Fr   r   r   c                     |                      |          |                      |          k    r | j        |||fi |S |                      |          } |j        |||fi |}d||d}|                     ||           |S )r   copyrO  r#   r   )rW  _copy_across_handlersr   r\  )rE   r   r   r   r{   rF  r]  rG  s           r5   rj  zPathManager.copy  s     ""8,,0G0G1
 1
 
 
 .4-h)VVvVVV))(33w}XxEEfEEX8DDw,,,rG   c                     |                      |          |                      |          k    s
J d            |                      |          } |j        ||fi |}d||d}|                     ||           |S )a  
        Moves (renames) a source path supported by NativePathHandler to
        a destination path.

        Args:
            src_path (str): A URI supported by NativePathHandler
            dst_path (str): A URI supported by NativePathHandler

        Returns:
            status (bool): True on success
        Exception:
            Asserts if both the src and dest paths are not supported by
            NativePathHandler.
        z>Src and dest paths must be supported by the same path handler.mvrk  )rW  r   r\  rE   r   r   r{   rF  r]  rG  s          r5   rn  zPathManager.mv  s    " &&
 
$$
 

 
 
 L	
 
 

 ))(33w{8X88888BBw,,,rG   r   c                     t          j        |          }|                     |          }	  |j        |fd|i|}n# t          $ r  |j        |fi |}Y nw xY wd||d}|                     ||           |S )a  
        Get a filepath which is compatible with native Python I/O such as `open`
        and `os.path`.

        If URI points to a remote resource, this function may download and cache
        the resource to local disk.

        Args:
            path (str): A URI supported by this PathHandler
            force(bool): Forces a download from backend if set to True.

        Returns:
            local_path (str): a file path which exists on the local file system
        r   get_local_path)rO  r#   r   )r"   r   rW  r   rX   r\  )rE   r#   r   r{   rF  r]  rG  s          r5   rq  zPathManager.get_local_path  s     y))$//	;*7*4GGuGGGDD 	; 	; 	;*7*4::6::DDD	;%teDD 	w,,,s   < AAr   c                     t           j                            |          sJ d|             |                     |          }d|||d} |j        d|||d|}|                     ||           |S )r   zlocal_path = copy_from_local)rO  r#   r   r   )r   r   r   rg   )r"   r#   r   rW  r   r\  )rE   r   r   r   r{   rF  rG  r]  s           r5   rs  zPathManager.copy_from_local  s    " w~~j))GG+G:+G+GGGG))(33 $ "	
 
 (w' 
!H	
 
MS
 

 	w,,,rG   c                     |                      |          } |j        |fi |}d|d}|                     ||           |S )r   r   rO  r#   )rW  r   r\  rE   r#   r{   rF  r]  rG  s         r5   r   zPathManager.exists  X     ))$//wt..v..t,,w,,,rG   c                     |                      |          } |j        |fi |}d|d}|                     ||           |S )z
        Checks if there the resource at the given URI is a file.

        Args:
            path (str): A URI supported by this PathHandler

        Returns:
            bool: true if the path is a file
        r   ru  )rW  r   r\  rv  s         r5   r   zPathManager.isfile  rw  rG   c                     |                      |          } |j        |fi |}d|d}|                     ||           |S )r   r  ru  )rW  r   r\  rv  s         r5   r  zPathManager.isdir/  sX     ))$//w~d--f--d++w,,,rG   c                 D     |                      |          j        |fi |S r   )rW  r   r   s      r5   lszPathManager.ls?  s-     1t&&t,,0@@@@@rG   c                     |                      |          } |j        |fi |}d|d}|                     ||           |S )r   r'   ru  )rW  r   r\  rv  s         r5   r'   zPathManager.mkdirsK  sX     ))$//wt..v..t,,w,,,rG   c                     |                      |          } |j        |fi |}d|d}|                     ||           |S )r   rmru  )rW  r   r\  rv  s         r5   r~  zPathManager.rmZ  sX     ))$//w{4**6**4((w,,,rG   c                     |                      |          |                      |          k    sJ |                      |          } |j        ||fi |}d||d}|                     ||           |S )zSymlink the src_path to the dst_path

        Args:
            src_path (str): A URI supported by this PathHandler to symlink from
            dst_path (str): A URI supported by this PathHandler to symlink to
        r   rk  )rW  r   r\  ro  s          r5   r   zPathManager.symlinkg  s     &&
 
$$X../ / / / ))(33w(==f==hGGw,,,rG   c                     |	| j         dS |                     |p| j                   } |                     |p| j                   j        |fi |r
|| _         d}nd}d|d}|                     ||           |S )aq  
        Set the current working directory. PathHandler classes prepend the cwd
        to all URI paths that are handled.

        Args:
            path (str) or None: A URI supported by this PathHandler. Must be a valid
                absolute Unix path or None to set the cwd to None.

        Returns:
            bool: true if cwd was set without errors
        NTFset_cwdru  )r
  rW  r   r\  rv  s         r5   r  zPathManager.set_cwdx  s     <DI-4 ))$*;$)<<>4""4#44955>tNNvNN 	DIDDD-- 	w,,,rG   Tallow_overridec           	         t          j        t                    }t          |t                    s
J |            t          |t
                    r|r|| _        nt          d          dS |                                D ]}|| j	        vr|| j	        |<   t          | j	        |                   }|rt| t          k    r^|                    d| dd                    t          j        d                    z              |                    d| d	| d
           || j	        |<   t!          d| d| d          t#          t%          | j	                                        d d                    | _	        dS )z
        Register a path handler associated with `handler._get_supported_prefixes`
        URI prefixes.

        Args:
            handler (PathHandler)
            allow_override (bool): allow overriding existing handler for prefix
        za`NativePathHandler` is registered by default. Use the `allow_override=True` kwarg to override it.Nz-[PathManager] Attempting to register prefix 'z!' from the following call stack:
    )limitz[PathManager] Prefix 'z' is already registered by zk. We will override the old handler. To avoid such conflicts, create a project-specific PathManager instead.z' already registered by !c                     | d         S )Nr   rg   )ts    r5   <lambda>z.PathManager.register_handler.<locals>.<lambda>  s
    ad rG   T)rY   reverse)r/   r0   r1   
isinstancers   r   r=  r   r   r<  rK  r&   r2   r,   	tracebackformat_stackKeyErrorr   sortedr   )rE   rF  r  r4   prefixold_handler_types         r5   register_handlerzPathManager.register_handler  s    "8,,';//88888 g011 	 ,3)) B   F5577 	 	FT000.5#F+#D$7$?@@  9$$NN6 6 6 6'')"8q"A"A"ABBC   NN# # #.# # #   /6#F++`V``M]```   *4&,,..NNDQQQ
 
rG   enablec                 d    || j         _        | j                                        D ]	}||_        
dS )a  
        Toggles strict kwargs checking. If enabled, a ValueError is thrown if any
        unused parameters are passed to a PathHandler function. If disabled, only
        a warning is given.

        With a centralized file API, there's a tradeoff of convenience and
        correctness delegating arguments to the proper I/O layers. An underlying
        `PathHandler` may support custom arguments which should not be statically
        exposed on the `PathManager` function. For example, a custom `HTTPURLHandler`
        may want to expose a `cache_timeout` argument for `open()` which specifies
        how old a locally cached resource can be before it's refetched from the
        remote server. This argument would not make sense for a `NativePathHandler`.
        If strict kwargs checking is disabled, `cache_timeout` can be passed to
        `PathManager.open` which will forward the arguments to the underlying
        handler. By default, checking is enabled since it is innately unsafe:
        multiple `PathHandler`s could reuse arguments with different semantic
        meanings or types.

        Args:
            enable (bool)
        N)r=  r}   r<  values)rE   r  rF  s      r5   set_strict_kwargs_checkingz&PathManager.set_strict_kwargs_checking  sC    , :@!6*1133 	2 	2G+1G((	2 	2rG   c                     || _         d S rI   )r@  )rE   enable_loggings     r5   rZ  zPathManager.set_logging  s    -rG   c                     |                      |          }|j        J |                      |          }|j        J  |j        |fi |} |j        ||fd|i|S )Nr   )rW  r   r   )rE   r   r   r   r{   src_handlerdst_handler
local_files           r5   rl  z!PathManager._copy_across_handlers  s     --h77*666--h77+7770[0DDVDD
+{+
 
,5
9?
 
 	
rG   r%  r   r   )r   r   Nr   )T).r1   r^   r_   r`   rF   r   ra   r"   PathLikers   rW  r   r   r\  r   r[  r   re   rX  r	   r   r   r   r   r   ra  r   re  rh  rj  rn  rq  rs  r   r   r  r   r{  r'   r~  r   r  r  r  rZ  rl  rg   rG   r5   r   r     s3           <)uS"+-='> ); ) ) ) )"- -4U
;K -PT - - - -0C s s tCQVJGW    8 <>U UU"U58UILU	U U U U& <> "58IL	r#w5	!	"   @ FJ= == = 	=
 $,HdVT\,B#C= = 
= = = =~      BC D      ?D '*7;OR	   43 #      8 3 t s s    8 AF! !!),!9=!QT!	! ! ! !F3 # $     3 # $     #       
As 
Ac 
Ad3i 
A 
A 
A 
A3 # $    s c d     s c d    "E#t),      : <@:
 :
":
48:
	:
 :
 :
 :
x2 2$ 2 2 2 28. . . .

'*
7;
GJ
	
 
 
 
 
 
rG   r   c                   R    e Zd ZdZdZi Zeedfdefd            Zed             Z	dS )PathManagerFactorya  
    PathManagerFactory is the class responsible for creating new PathManager
    instances and removing them when no longer needed.
    PathManager can be instantiated directly too, but it is recommended that
    you use PathManagerFactory to create them.
    global_path_managerFr   c                     | t           j        vrPt                      t           j        | <   |r3	 ddlm}  |t           j        |                     n# t
          $ r Y nw xY wt           j        |          S )a$  
        Get the path manager instance associated with a key.
        A new instance will be created if there is no existing
        instance associated with the key passed in.
        Args:
            key (str):
            defaults_setup (bool): If True, setup_defaults is called.
        r   )setup_defaults)r  pm_listr   ry   r  rz   )rY   defaults_setupr  s      r5   getzPathManagerFactory.get   s     (000.9mm&s+ KKKKKK"N#5#=c#BCCCC"   D ")#..s   !A 
AAc                 f    | t           j        v r"t           j                            |           }~dS dS )zn
        Remove the path manager instance associated with a key.
        Args:
            key (str):
        N)r  r  pop)rY   _pms     r5   r  zPathManagerFactory.remove7  s8     $,,,$,0055C -,rG   N)
r1   r^   r_   r`   GLOBAL_PATH_MANAGERr  staticmethodr   r  r  rg   rG   r5   r  r    su          0G#E / /k / / / \/*   \  rG   r  T)r  rI   )9r-  concurrent.futuresr   r  r/   r"   r   r-   r  r  collectionsr   ior   typesr   typingr   r   r   r	   r
   r   r   r   r   r   r   r   r   urllib.parser   r<   iopath.common.downloadr   iopath.common.event_loggerr   r   iopath.common.non_blocking_ior   typing_extensionsr   __all__ra   r   r   r  r   re   rs   r   r  r'  r   r  r  r&   rg   rG   r5   <module>r     s          				        # # # # # #                                          " ! ! ! ! !     + + + + + + 9 9 9 9 9 9 9 9 > > > > > > & & & & & & D
C
C Xc] c    6:C : : : :B1% 1% 1% 1% 1%r{ 1% 1% 1%h       *A A A A A+ A A AHd
 d
 d
 d
 d
 d
 d
 d
NI& I& I& I& I&[ I& I& I&X)U )U )U )U )U. )U )U )UXi	
 i	
 i	
 i	
 i	
 i	
 i	
 i	
X,. . . . . . . .b ""$"77			rG   