
    <Bh9                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr  S
SKJrJr  S
SKJrJrJr  \(       a  SSKJr   " S S\5      r " S S\5      r " S S\5      r\" SS9S 5       rg)z
Defines a JSON reporter backend

This reporter backend is used to provide JSON strings for output rendering. It is
essentially just a wrapper around ``conda.common.serialize.json_dump``.
    )annotationsN)RLock)TYPE_CHECKING   )DEFAULT_JSON_REPORTER_BACKEND)swallow_broken_pipe	json_dump   )CondaReporterBackendhookimpl)ProgressBarBaseReporterRendererBaseSpinnerBase)Anyc                  l   ^  \ rS rSrSr S	   S
U 4S jjjrSS jrS r\S 5       r	\
S 5       rSrU =r$ )JSONProgressBar   z*
Progress bar that outputs JSON to stdout
c                0   > [         TU ]  U5        X l        g N)super__init__enabled)selfdescriptionr   kwargs	__class__s       Dlib/python3.13/site-packages/conda/plugins/reporter_backends/json.pyr   JSONProgressBar.__init__   s     	%    c                    U R                  5          U R                  (       a1  [        R                  R	                  SU R
                   SUS S35        S S S 5        g ! , (       d  f       g = f)N
{"fetch":"z)","finished":false,"maxval":1,"progress":fz}
 )get_lockr   sysstdoutwriter   )r   fractions     r   	update_toJSONProgressBar.update_to(   sN    ]]_||

  !$"2"2!33\]efg\hhno __s   AA
A+c                    g r    r   s    r   refreshJSONProgressBar.refresh/       r    c                   U R                  5          U R                  (       aK  [        R                  R	                  SU R
                   S35        [        R                  R                  5         S S S 5        g ! , (       d  f       g = f)Nr"   z,","finished":true,"maxval":1,"progress":1}
 )r$   r   r%   r&   r'   r   flushr-   s    r   closeJSONProgressBar.close2   sT    ]]_||

  !$"2"2!33bc 

  " __s   AA77
Bc                Z    [        U S5      (       d  [        5       U l        U R                  $ )z/
Used for our own sys.stdout.write/flush calls
_lock)hasattrr   r6   )clss    r   r$   JSONProgressBar.get_lock;   s$    
 sG$$CIyyr    )r   )T)r   strr   bool)returnNone)__name__
__module____qualname____firstlineno____doc__r   r)   r.   r   r3   classmethodr$   __static_attributes____classcell__)r   s   @r   r   r      s[        # #  r    r   c                  p    \ rS rSrSrSS jrSS jrSS jr    SS jrSSS jjr	 S     SS jjr
S	rg
)JSONReporterRendererE   z4
Default implementation for JSON reporting in conda
c                    [        U5      $ r   r	   r   datar   s      r   renderJSONReporterRenderer.renderJ       r    c                    [        U5      $ r   r	   rJ   s      r   detail_view JSONReporterRenderer.detail_viewM   rN   r    c                    [        SU05      $ )Nenvsr	   rJ   s      r   	envs_listJSONReporterRenderer.envs_listP   s    &$((r    c                    [        U40 UD6$ r   )r   )r   r   r   s      r   progress_bar!JSONReporterRenderer.progress_barS   s    
 {5f55r    c                    [        X5      $ r   )JSONSpinner)r   messagefail_messages      r   spinnerJSONReporterRenderer.spinnerZ   s    711r    c                    g)z3
For this class, we want this method to do nothing
Nr,   )r   r[   choicesdefaults       r   promptJSONReporterRenderer.prompt]   s    r    r,   N)rK   r   r<   r:   )rK   zdict[str, str | int | bool]r<   r:   )r<   r:   )r   r:   r<   r   )zfailed
)r[   r:   r\   r:   r<   r   )Proceed)yesnore   )r[   r:   ra   r:   r<   r:   )r>   r?   r@   rA   rB   rL   rP   rT   rW   r]   rb   rD   r,   r    r   rG   rG   E   s[    )66 
	62 OTHK	 r    rG   c                  $    \ rS rSrSrS rS rSrg)rZ   e   zZ
This class for a JSONSpinner does nothing because we do not want to include this output.
c                    g r   r,   r-   s    r   	__enter__JSONSpinner.__enter__j   r0   r    c                    g r   r,   )r   exc_typeexc_valexc_tbs       r   __exit__JSONSpinner.__exit__m   r0   r    r,   N)r>   r?   r@   rA   rB   rj   rp   rD   r,   r    r   rZ   rZ   e   s    r    rZ   T)tryfirstc               #  6   #    [        [        S[        S9v   g7f)zg
Reporter backend for JSON

This is the default reporter backend that returns objects as JSON strings.
z2Default implementation for JSON reporting in conda)namer   rendererN)r   r   rG   r,   r    r   conda_reporter_backendsrv   q   s      *H% s   )rB   
__future__r   r%   	threadingr   typingr   base.constantsr   	common.ior   common.serializer
    r   r   typesr   r   r   r   r   rG   rZ   rv   r,   r    r   <module>r      ss    # 
    ; , ) - F F(o (V/ @	+ 	 


r    