
    Tj                         d Z ddlZddlZddlmZ ddgiZg dZdedd	Zd
deddZ	ddefdZ
defdZdefdZdefdZdS )z#
Thin wrappers around `itertools`.
    N   )tqdmzgithub.com/	casperdcl)chainproductpermutationscombinationscombinations_with_replacementbatched)total
tqdm_classc                     | ;	 t          t          t          |                    } n# t          t          f$ r Y nw xY w |t          j        | fd| i|S )z Equivalent of `itertools.chain`.Nr   )summaplen	TypeErrorAttributeError	itertoolsr   )r   r   	iterableskwargss       Z/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/tqdm/contrib/itertools.pyr   r      sn    }	C++,,EE>* 	 	 	D	:ioy1III&IIIs   "' ;;   )repeatr   r   c              /      K   |R	 t          t          t          |                    }t          j        |          | z  }n# t
          t          f$ r Y nw xY w |t          j        |d| ifd|i|E d{V  dS )z"Equivalent of `itertools.product`.Nr   r   )	listr   r   mathprodr   r   r   r   )r   r   r   r   r   lenss         r   r   r      s      }	.C++,,D IdOOv-EE >* 	 	 	D	 z)+YFvFF^^e^W]^^^^^^^^^^^s   "A   AAc                     |L	 t          |           }||n|}||k    rd}n-t          j        ||          }n# t          t          f$ r Y nw xY w |t          j        | |          fd|i|S )z'Equivalent of `itertools.permutations`.Nr   r   )r   r   permr   r   r   r   iterablerr   r   r   ns         r   r   r   $   s    }		(HA YAA1uu	!Q >* 	 	 	D	 :i,Xq99QQQ&QQQs   8 AAc                     |F	 t          |           }||k    rd}n-t          j        ||          }n# t          t          f$ r Y nw xY w |t          j        | |          fd|i|S )z'Equivalent of `itertools.combinations`.Nr   r   )r   r   combr   r   r   r	   r!   s         r   r	   r	   4   s    }	(HA 1uu	!Q >* 	 	 	D	 :i,Xq99QQQ&QQQs   2 AAc                    |g	 t          |           }d}t          ||z   dz
  |dz
  d          D ]}||z  }t          d|dz             D ]}||z  }n# t          t          f$ r Y nw xY w |t	          j        | |          fd|i|S )z8Equivalent of `itertools.combinations_with_replacement`.Nr   r   )r   ranger   r   r   r
   )r"   r#   r   r   r   r$   is          r   r
   r
   C   s    }		HA E1Q3q5!A#r**  
1ac]]  ! >* 	 	 	D	 :i=hJJbbRWb[abbbs   A A'&A'c                     |(	 t          |           }n# t          t          f$ r Y nw xY w |t          j        | |          f||||z   dz
  |z  ndd|S )z"Equivalent of `itertools.batched`.Nr   )
unit_scaler   )r   r   r   r   r   )r"   r$   r   r   r   s        r   r   r   S   s    }	MMEE>* 	 	 	D	:i'!44  050AU1WQY1,,t        s    (()__doc__r   r   autor   	tqdm_auto
__author____all__r   r   r   r	   r
   r        r   <module>r4      s(         $ $ $ $ $ $k]+
d d d !Y J J J J J  ! 	_ 	_ 	_ 	_ 	_ ") R R R R  %)Y R R R R 6:i c c c c   $	 	  	  	  	  	  	 r3   