
    DIe	                        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  ej        e          Z	 	 dddZedd            ZdS )zNotices network fetch logic.    )annotationsN)ThreadPoolExecutor)Sequence   )Spinner)get_session   )cached_response)ChannelNoticeResponseF
   url_and_namesSequence[tuple[str, str]]silentboolmax_workersintreturnSequence[ChannelNoticeResponse]c                    t          |          }t          d|           5  t          t          dd |                    d |           D                                 cddd           S # 1 swxY w Y   dS )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]
    )r   zRetrieving notices)enabledNc              3     K   | ]}|V  d S N ).0chn_infos     3lib/python3.11/site-packages/conda/notices/fetch.py	<genexpr>z'get_notice_responses.<locals>.<genexpr>*   s6                   c                    t          |  S r   )get_channel_notice_response)argss    r   <lambda>z&get_notice_responses.<locals>.<lambda>-   s    %@$%G r   )r   r   tuplefiltermap)r   r   r   executors       r   get_notice_responsesr'      s      "k:::H	%6z	:	:	: 
 
 $,LLGG% %   

 


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   <A,,A03A0urlstrnameChannelNoticeResponse | Nonec           	     v   t          |           }	 |                    | dd          }n{# t          j        j        $ r$ t
                              d| d|             Y dS t          j        j        $ r.}t
                              d| d| d|             Y d}~dS d}~ww xY w	 |j	        d	k     r$t          | ||                                
          S t
                              d|j	         d|             dS # t          $ r2 t
                              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   json
ValueError)r(   r*   sessionrespexcs        r   r    r    4   s    #G	{{  
 
 &   GdGG#GGHHH/   LsLL4LLsLLMMM@c!!(ddiikkJJJJKKOD$4OO#OOPPPPP @ @ @:S::;;;$S$$??????@s3   * 4B"!B"4#BB"&.C< %C< <9D87D8)Fr   )r   r   r   r   r   r   r   r   )r(   r)   r*   r)   r   r+   )__doc__
__future__r   loggingconcurrent.futuresr   typingr   r2   	common.ior   gateways.connection.sessionr   cacher
   typesr   	getLogger__name__r5   r'   r    r   r   r   <module>rJ      s   # " " " " " " "  1 1 1 1 1 1              5 5 5 5 5 5 " " " " " " ( ( ( ( ( (		8	$	$
 
 
 
 
 
@ @ @ @ @ @ @r   