
    sKg                         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ej                  dk(  rdZddlmZ d ZyddlmZ y# e$ r	 	 	 dd
ZY /w xY w)z,
Backports of fixes for joblib dependencies
    N)basename)utilc                   <    e Zd ZdZd
dZd Zd Zd Zd Zd Z	d	 Z
y)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                 ,    |r| j                  |       y y Nparseselfvstrings     T/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/joblib/backports.py__init__zVersion.__init__       JJw     c                 L    | j                   j                  dt        |       dS )Nz ('z'))	__class____name__strr   s    r   __repr__zVersion.__repr__   s    "nn55s4yAAr   c                 B    | j                  |      }|t        u r|S |dk(  S Nr   _cmpNotImplementedr   othercs      r   __eq__zVersion.__eq__   &    IIeHAvr   c                 B    | j                  |      }|t        u r|S |dk  S r   r   r   s      r   __lt__zVersion.__lt__#   &    IIeH1ur   c                 B    | j                  |      }|t        u r|S |dk  S r   r   r   s      r   __le__zVersion.__le__)   r"   r   c                 B    | j                  |      }|t        u r|S |dkD  S r   r   r   s      r   __gt__zVersion.__gt__/   r%   r   c                 B    | j                  |      }|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r   r   c                   j    e Zd ZdZ ej
                  dej                        Zd	dZd Z	d Z
d Zd Zy)
LooseVersionr   z(\d+ | [a-z]+ | \.)Nc                 ,    |r| j                  |       y y r	   r
   r   s     r   r   zLooseVersion.__init__H   r   r   c                     || _         | j                  j                  |      D cg c]  }|r|dk7  r| }}t        |      D ]  \  }}	 t	        |      ||<    || _        y c c}w # t
        $ r Y /w xY w)N.)r   component_resplit	enumerateint
ValueErrorversion)r   r   x
componentsiobjs         r   r   zLooseVersion.parseL   s     !%!2!2!8!8!A )!AAqCx !A
 )
+FAs #C
1 , ")
  s   A!	A&&	A21A2c                     | j                   S r	   )r   r   s    r   __str__zLooseVersion.__str__[   s    ||r   c                     dt        |       z  S )NzLooseVersion ('%s'))r   r   s    r   r   zLooseVersion.__repr__^   s    $s4y00r   c                    t        |t              rt        |      }nt        |t              st        S | j                  |j                  k(  ry| j                  |j                  k  ry| j                  |j                  kD  ryy )Nr      )
isinstancer   r1   r   r:   )r   r   s     r   r   zLooseVersion._cmpa   sd    eS! 'EE<0!!<<5==(<<%--'<<%--' (r   r	   )r   r,   r-   r.   recompileVERBOSEr5   r   r   r@   r   r   r/   r   r   r1   r1   <   s9     2::4bjjAL "1r   r1   c                 $   t        j                  dj                  |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.13rD   )add_maybe_unlink_finalizer)r   debugformatr   osgetpidnpmemmapr1   __version__rL   _memmapping_reducerrO   )	filenamerJ   rK   rL   rM   rN   unlink_on_gc_collectmmrO   s	            r   make_memmapr[   r   sv     	

fUHX$6		D	

 YYxu4"%1'&0BIG&r*	r   c                     t        d      )NzL'joblib.backports.make_memmap' should not be used if numpy is not installed.)NotImplementedError)rX   rJ   rK   rL   rM   rN   rY   s          r   r[   r[      s    !)* 	*r   nt)      )replacec                     d}d}d}||k  r	 t        | |       y # t        $ r>}t        |dd      t        v r t	        j
                  |       ||z  }|dz  }n Y d}~nd}~ww xY w||k  r_R)zRenames ``src`` into ``dst`` overwriting ``dst`` if it exists.

        On Windows os.replace can yield permission errors if executed by two
        different processes.
        rD   r   gMbP?winerrorN   )ra   	Exceptiongetattraccess_denied_errorstimesleep)srcdstmax_sleep_timetotal_sleep_time
sleep_timeexcs         r   concurrency_safe_renamerp      s     
/	S!   3
D15IIJJz*$
2$!OJ 		 /s    	A"4AA")uint8zr+r   NCF)r.   rR   rF   rh   os.pathr   multiprocessingr   r   r1   numpyrT   r[   ImportErrornamerg   ra   rp   r/   r   r   <module>rx      s    
 	    - -`07 0f#*?@@EF 77d?". 6I  *?@@E**s   
A A+*A+