Ë
    $Æ%h’  ã                   óz   — d 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 dd	giZd
dgZedd„«       Zd„ Zd„ Zd„ Zy)z,
Thin wrappers around `concurrent.futures`.
é    )Úcontextmanager)Úlength_hint)Ú	cpu_counté   )Útqdm)ÚTqdmWarningzgithub.com/Ú	casperdclÚ
thread_mapÚprocess_mapc              #   ó¾   K  — t        | dd«      }|xs | j                  «       }t        |||«      }| j                  |«       |–— |€| `y| j                  |«       y­w)z>get (create if necessary) and then restore `tqdm_class`'s lockÚ_lockN)ÚgetattrÚget_lockÚset_lockr   )Ú
tqdm_classÚ	lock_nameÚold_lockÚlocks       úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/tqdm/contrib/concurrent.pyÚensure_lockr      sd   è ø€ ô �z 7¨DÓ1€HØÒ,�z×*Ñ*Ó,€DÜ�4˜ DÓ)€DØ×Ñ˜ÔØ
‚JØÐØÑà×Ñ˜HÕ%ùs   ‚AAc                 ó  — |j                  «       }d|vrt        |d   «      |d<   |j                  dt        «      }|j                  dt	        dt        «       dz   «      «      }|j                  dd«      }|j                  d	d
«      }t        ||¬«      5 }	 | ||j                  |	f¬«      5 }
t         | |
j                  |g|¢­d|iŽfi |¤Ž«      cddd«       cddd«       S # 1 sw Y   nxY w	 ddd«       y# 1 sw Y   yxY w)a  
    Implementation of `thread_map` and `process_map`.

    Parameters
    ----------
    tqdm_class  : [default: tqdm.auto.tqdm].
    max_workers  : [default: min(32, cpu_count() + 4)].
    chunksize  : [default: 1].
    lock_name  : [default: "":str].
    Útotalr   r   Úmax_workersé    é   Ú	chunksizeé   r   Ú )r   )r   ÚinitializerÚinitargsN)
Úcopyr   ÚpopÚ	tqdm_autoÚminr   r   r   ÚlistÚmap)ÚPoolExecutorÚfnÚ	iterablesÚtqdm_kwargsÚkwargsr   r   r   r   ÚlkÚexs              r   Ú_executor_mapr.      s  € ð ×ÑÓ€FØ�fÑÜ% i°¡lÓ3ˆˆw‰Ø—‘˜L¬)Ó4€JØ—*‘*˜]¬C°´I³KÀ!±OÓ,DÓE€KØ—
‘
˜;¨Ó*€IØ—
‘
˜;¨Ó+€IÜ	�Z¨9Ô	5ð [¸á k¸z×?RÑ?RØ$& 5ô*ð 	[Ø-/Ü™
 6 2§6¡6¨"Ð#N¨yÒ#NÀIÑ#NÑYÐRXÑYÓZ÷	[ð 	[÷[ñ [÷	[ð 	[úð 	[÷[÷ [ñ [ús$   ÂC:Â+&C$Ã	C:Ã$C-	Ã)C:Ã:Dc                 ó.   — ddl m} t        || g|¢­i |¤ŽS )a¢  
    Equivalent of `list(map(fn, *iterables))`
    driven by `concurrent.futures.ThreadPoolExecutor`.

    Parameters
    ----------
    tqdm_class  : optional
        `tqdm` class to use for bars [default: tqdm.auto.tqdm].
    max_workers  : int, optional
        Maximum number of workers to spawn; passed to
        `concurrent.futures.ThreadPoolExecutor.__init__`.
        [default: max(32, cpu_count() + 4)].
    r   )ÚThreadPoolExecutor)Úconcurrent.futuresr0   r.   )r(   r)   r*   r0   s       r   r
   r
   6   s   € õ 6ÜÐ+¨RÐK°)ÒK¸{ÑKÐKó    c                 óØ   — ddl m} |r:d|vr6t        t        t        |«      «      }|dkD  rddlm}  |d|z  t        d¬«       d	|vr|j                  «       }d
|d	<   t        || g|¢­i |¤ŽS )a¦  
    Equivalent of `list(map(fn, *iterables))`
    driven by `concurrent.futures.ProcessPoolExecutor`.

    Parameters
    ----------
    tqdm_class  : optional
        `tqdm` class to use for bars [default: tqdm.auto.tqdm].
    max_workers  : int, optional
        Maximum number of workers to spawn; passed to
        `concurrent.futures.ProcessPoolExecutor.__init__`.
        [default: min(32, cpu_count() + 4)].
    chunksize  : int, optional
        Size of chunks sent to worker processes; passed to
        `concurrent.futures.ProcessPoolExecutor.map`. [default: 1].
    lock_name  : str, optional
        Member of `tqdm_class.get_lock()` to use [default: mp_lock].
    r   )ÚProcessPoolExecutorr   iè  )Úwarnz…Iterable length %d > 1000 but `chunksize` is not set. This may seriously degrade multiprocess performance. Set `chunksize=1` or more.r   )Ú
stacklevelr   Úmp_lock)
r1   r4   Úmaxr&   r   Úwarningsr5   r   r!   r.   )r(   r)   r*   r4   Úlongest_iterable_lenr5   s         r   r   r   H   s‡   € õ& 7Ù�[¨Ñ3ô  #¤3¤{°IÓ#>Ó?ÐØ $Ò&Ý%Ùð /à1EñFô ¨õ,ð ˜+Ñ%Ø!×&Ñ&Ó(ˆØ#,ˆ�KÑ ÜÐ,¨bÐL°9ÒLÀÑLÐLr2   N)r   )Ú__doc__Ú
contextlibr   Úoperatorr   Úosr   Úautor   r#   Ústdr   Ú
__author__Ú__all__r   r.   r
   r   © r2   r   ú<module>rD      sW   ðñõ &Ý  Ý å $Ý à˜k˜]Ð+€
Ø˜Ð
'€ð ò
&ó ð
&ò[ò2Ló$!Mr2   