
    wBfh
                        d Z ddlmZ ddlZddlmZ ddlm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 d
dlmZ erddlmZ  ej(                  e      Z	 	 d	 	 	 	 	 	 	 ddZedd       Zy)zNotices network fetch logic.    )annotationsN)ThreadPoolExecutor)TYPE_CHECKING   )context)Spinner)get_session   )cached_response)ChannelNoticeResponse)Sequencec                    t        |      }t        d| t        j                        5  t	        t        dd |j                  d |       D                    cddd       S # 1 sw Y   yxY w)a  
    Provided a list of channel notification url/name tuples, return a sequence of
    ChannelNoticeResponse objects.

    Args:
        url_and_names: channel url and the channel name
        silent: turn off "loading animation" (defaults to False)
        max_workers: increase worker number in thread executor (defaults to 10)
    Returns:
        Sequence[ChannelNoticeResponse]
    )max_workerszRetrieving notices)enabledjsonNc              3      K   | ]  }|  y wN ).0chn_infos     3lib/python3.12/site-packages/conda/notices/fetch.py	<genexpr>z'get_notice_responses.<locals>.<genexpr>/   s        s   c                    t        |  S r   )get_channel_notice_response)argss    r   <lambda>z&get_notice_responses.<locals>.<lambda>2   s    %@$%G     )r   r   r   r   tuplefiltermap)url_and_namessilentr   executors       r   get_notice_responsesr$      sd      "k:H	%6z	M 
$,LLG%


 
 
s   -A!!A*c           	     R   t        |       }	 |j                  | dd      }	 |j                  d	k  rt        | ||j                         
      S t
        j                  d|j                   d|         y# t        j                  j                  $ r t
        j                  d| d|         Y yt        j                  j                  $ r(}t
        j                  d| d| d|         Y d}~yd}~ww xY w# t        $ r) t
        j                  d|         t        | |d
      cY S w xY w)z
    Return a channel response object. We use this to wrap the response with
    additional channel information to use. If the response was invalid we suppress/log
    and error message.
    F   )allow_redirectstimeoutzRequest timed out for channel: z url: NzRequest error <z> for channel: i,  )	json_dataz	Received z when trying to GET zUnable to parse JSON data for )r	   getrequests
exceptionsTimeoutloggerinfoRequestExceptionerrorstatus_coder   r   
ValueError)urlnamesessionrespexcs        r   r   r   9   s    #G	{{  
@c!(ddiikJJKK)D$4$4#55I#OP && 5dV6#GH// se?4&seLM  @4SE:;$S$$??@s4   A3 *C4 %C4 38C1-C1	C,,C14/D&%D&)F
   )r!   zSequence[tuple[str, str]]r"   boolr   intreturnzSequence[ChannelNoticeResponse])r4   strr5   r=   r<   zChannelNoticeResponse | None)__doc__
__future__r   loggingconcurrent.futuresr   typingr   r+   base.contextr   	common.ior   gateways.connection.sessionr	   cacher   typesr   r   	getLogger__name__r.   r$   r   r   r   r   <module>rJ      s    # "  1    "  5 " (			8	$
 
,

 
 %	
@ @ @r   