
    VFf                         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ej                  dk\  rd dl
Z
n	d dlmc mZ
  G d de      Z G d de      Z G d d	e      Z G d
 de      Z G d de      Z G d de      Zy)    )absolute_importprint_functionunicode_literalsN)      c                   "    e Zd ZdZedd       Zy)RequirementsTXTUpdaterz^{}(?=\s*\r?\n?$)c                    dj                  |j                  ||      }d}d|j                  v rh|d|j                  j                         d   j	                  dd      d   j	                  d      d   j	                  d      d   j                         z   z  }d|j                  v r|j                  j	                  d      }|d   dj                  |dd	       }
}	t        t        d
            t        t        d            f}d}|	d	d	d   D ]  }t        t        |            |v r||z  } n ||dz   |
z   z  }|j                  r|j                  d      s|dz  }|rFt        |      D ]8  \  }}|dj                  |d   |d         z  }t        |      |dz   kD  s4|dz  }: ||z  }| j                  j                  t        j                  |j                              }t        j                   |||t        j"                        S )z
        Updates the requirement to the latest version for the given content
        and adds hashes if necessary.
        :param content: str, content
        :return: str, updated content
        z{name}{spec}{version})namespecversion ;r      #z--hashN	 \z \z
    --hash={method}:{hash}methodhash)r   r   )flags)format	full_nameline
splitlinessplitrstripjoinhexordhashesendswith	enumeratelen	SUB_REGEXreescapesub	MULTILINE)clscontent
dependencyr   r   r"   new_lineappendixpartsrequirementcommentwhitespacestrailing_whitespacecnnew_hashregexs                    `/var/www/html/alibri-web-admin/venv/lib/python3.12/site-packages/pipenv/vendor/dparse/updater.pyupdatezRequirementsTXTUpdater.update   s    +11z7K7K7;W 2 N*//! "224Q7==c1EaH"U3Z++05?1>>DfhG GH *//!OO))#.E#(8SXXeABi-@Ks4y>3s3x=9K"$ 2& s1v;+-'1,'	
 +c1G;;H X%6%6t%<H(0 &8:AA#H-!&) B  
 v;Q&%H& 	H$$RYYz%?@vveXwbllCC    Nz== )__name__
__module____qualname__r&   classmethodr:   r=   r;   r9   r	   r	      s    $I1D 1Dr;   r	   c                       e Zd ZdZy)CondaYMLUpdaterz{}(?=\s*\r?\n?$)N)r>   r?   r@   r&   r=   r;   r9   rC   rC   G   s    #Ir;   rC   c                       e Zd Zy)ToxINIUpdaterNr>   r?   r@   r=   r;   r9   rE   rE   L       r;   rE   c                       e Zd Zy)SetupCFGUpdaterNrF   r=   r;   r9   rI   rI   P   rG   r;   rI   c                       e Zd Zedd       Zy)PipfileUpdaterc                    t        j                  |      }|rAdD ]<  }||v s|j                  ||   v sdj                  ||      ||   |j                  <   > 	 ddlm} t        j                  d      }	 |d	      }
|
j                  ||	j                  
       t        |	j                        j                         }t        j                  |	j                         |S # t        $ r t        d      w xY w)N)packageszdev-packages{spec}{version}r   r   r   )ProjectzhUpdating a Pipfile requires the pipenv extra to be installed. Install it with pip install dparse[pipenv]F)delete)chdir)datapath)tomllibloadsr   r   pipenv.projectrP   ImportErrortempfileNamedTemporaryFile
write_tomlr   openreadosremove)r+   r,   r-   r   r   r"   rS   package_typerP   pipfileps              r9   r:   zPipfileUpdater.updateU   s    }}W% < 4'!++tL/AA4E4L4L!%w 5M 5 \*&002	?.
 --U;% 	$W\\2GLL!&&(
		',,  	?>? ?	?s   C   C5Nr<   r>   r?   r@   rA   r:   r=   r;   r9   rK   rK   T   s     r;   rK   c                       e Zd Zedd       Zy)PipfileLockUpdaterc           	      B   t        j                  |      }|ridD ]d  }||v s|j                  ||   v s|D cg c]  }dj                  |d   |d          c}dj                  ||      d||   |j                  <   f t        j                  |d	d
      dz   S c c}w )N)defaultdevelopz{method}:{hash}r   r   )r   r   rN   rO   )r"   r      ),z: )indent
separators
)jsonrV   r   r   dumps)	r+   r,   r-   r   r   r"   rS   r`   hs	            r9   r:   zPipfileLockUpdater.updateo   s    zz'" 6 4'!++tL/AA ,2	' '( !2 8 8)*6+,X; !9 !"' (9'?'?%)7 (@ (
D\*:+?+?@ zz$q[ADHH's    BNr<   rc   r=   r;   r9   re   re   n   s    I Ir;   re   )
__future__r   r   r   r'   rn   rY   r^   sysversion_inforU   pipenv.vendor.tomlivendortomliobjectr	   rC   rE   rI   rK   re   r=   r;   r9   <module>rx      s    H H 	   	 
w))5DV 5Dp$, $
	O 		o 	V 4I Ir;   