
    .PhJ                         d Z ddlZddlZddlZddlmZ ddlmZ  G d d          Z G d de          Z		 ddl
Z	 	 	 	 	 	 ddZn# e$ r 	 	 	 	 	 	 ddZY nw xY wej        dk    rdZddlmZ d ZdS ddlmZ dS )z,
Backports of fixes for joblib dependencies
    N)util)basenamec                   >    e Zd ZdZd
dZd Zd Zd Zd Zd Z	d	 Z
dS )VersionBackport from deprecated distutils

    We maintain this backport to avoid introducing a new dependency on
    `packaging`.

    We might rexplore this choice in the future if all major Python projects
    introduce a dependency on packaging anyway.
    Nc                 8    |r|                      |           d S d S Nparseselfvstrings     P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/joblib/backports.py__init__zVersion.__init__   ,     	 JJw	  	     c                 @    | j         j        dt          |           dS )Nz ('z'))	__class____name__strr   s    r   __repr__zVersion.__repr__   s"    "n555s4yyyyAAr   c                 N    |                      |          }|t          u r|S |dk    S Nr   _cmpNotImplementedr   othercs      r   __eq__zVersion.__eq__   ,    IIeHAvr   c                 N    |                      |          }|t          u r|S |dk     S r   r   r   s      r   __lt__zVersion.__lt__#   ,    IIeH1ur   c                 N    |                      |          }|t          u r|S |dk    S r   r   r   s      r   __le__zVersion.__le__)   r"   r   c                 N    |                      |          }|t          u r|S |dk    S r   r   r   s      r   __gt__zVersion.__gt__/   r%   r   c                 N    |                      |          }|t          u r|S |dk    S r   r   r   s      r   __ge__zVersion.__ge__5   r"   r   r	   )r   
__module____qualname____doc__r   r   r!   r$   r'   r)   r+    r   r   r   r      s                B B B            r   r   c                   ^    e Zd ZdZ ej        dej                  Zd	dZd Z	d Z
d Zd ZdS )
LooseVersionr   z(\d+ | [a-z]+ | \.)Nc                 8    |r|                      |           d S d S r	   r
   r   s     r   r   zLooseVersion.__init__H   r   r   c                     || _         d | j                            |          D             }t          |          D ](\  }}	 t	          |          ||<   # t
          $ r Y %w xY w|| _        d S )Nc                 "    g | ]}||d k    
|S ).r/   ).0xs     r   
<listcomp>z&LooseVersion.parse.<locals>.<listcomp>Q   s#    TTTAQT1PS88a888r   )r   component_resplit	enumerateint
ValueErrorversion)r   r   
componentsiobjs        r   r   zLooseVersion.parseL   s     TT!2!8!8!A!ATTT

++ 	 	FAs #C
1    "s   A
A! A!c                     | j         S r	   )r   r   s    r   __str__zLooseVersion.__str__Z   s
    |r   c                 &    dt          |           z  S )NzLooseVersion ('%s'))r   r   s    r   r   zLooseVersion.__repr__]   s    $s4yy00r   c                     t          |t                    rt          |          }nt          |t                    st          S | j        |j        k    rdS | j        |j        k     rdS | j        |j        k    rdS d S )Nr      )
isinstancer   r1   r   r>   )r   r   s     r   r   zLooseVersion._cmp`   s    eS!! 	" ''EEE<00 	"!!<5=((1<%-''2<%-''1 ('r   r	   )r   r,   r-   r.   recompileVERBOSEr9   r   r   rC   r   r   r/   r   r   r1   r1   <   s          2:4bjAAL       " " "  1 1 1    r   r1   uint8r+CFc                 6   t          j        d                    |t          |           t	          j                                         t          j        | |||||          }t          t          j	                  dk     r||_
        |rddlm}  ||           |S )ab  Custom memmap constructor compatible with numpy.memmap.

        This function:
        - is a backport the numpy memmap offset fix (See
          https://github.com/numpy/numpy/pull/8443 for more details.
          The numpy fix is available starting numpy 1.13)
        - adds ``unlink_on_gc_collect``, which specifies  explicitly whether
          the process re-constructing the memmap owns a reference to the
          underlying file. If set to True, it adds a finalizer to the
          newly-created memmap that sends a maybe_unlink request for the
          memmaped file to resource_tracker.
        z?[MEMMAP READ] creating a memmap (shape {}, filename {}, pid {}))dtypemodeoffsetshapeorderz1.13rG   )add_maybe_unlink_finalizer)r   debugformatr   osgetpidnpmemmapr1   __version__rR   _memmapping_reducerrU   )	filenamerP   rQ   rR   rS   rT   unlink_on_gc_collectmmrU   s	            r   make_memmapra   q   s    * 	
MTTx))29;; 	
 	
 	
 YEV5PU
 
 
 ''&00BI 	+GGGGGG&&r***	r   c                      t          d          )NzL'joblib.backports.make_memmap' should not be used if numpy is not installed.)NotImplementedError)r^   rP   rQ   rR   rS   rT   r_   s          r   ra   ra      s     ")
 
 	
r   nt)      )replacec                     d}d}d}||k     rh	 t          | |           dS # t          $ rB}t          |dd          t          v rt	          j        |           ||z  }|dz  }n Y d}~nd}~ww xY w||k     h )zRenames ``src`` into ``dst`` overwriting ``dst`` if it exists.

        On Windows os.replace can yield permission errors if executed by two
        different processes.
        rG   r   gMbP?winerrorN   )rg   	Exceptiongetattraccess_denied_errorstimesleep)srcdstmax_sleep_timetotal_sleep_time
sleep_timeexcs         r   concurrency_safe_renamerv      s     
//	S!!!   3
D115IIIJz***$
2$!OJJ JJJJ		 // s     
A,8A''A,)rL   rM   r   NrN   F)r.   rX   rI   rn   multiprocessingr   os.pathr   r   r1   numpyrZ   ra   ImportErrornamerm   rg   rv   r/   r   r   <module>r|      s    
			 				                   - - - - - - - -`/ / / / /7 / / /d6
 "$ $ $ $ $J  
 
 
 "
 
 
 
 
 

" 7d??"    . 65555555s   A AA