


from collections.abc import Iterable
from typing import Generic, TypeVar

_A		       =						TypeVar('_T')






class     UpperCAmelCase__       (					Generic[_T]		):



    """simple docstring"""






    def __init__(			self					,   A_ = None    )  ->       None:
         __UpperCamelCase    							=list(iterable or []    )
         __UpperCamelCase    							=[]






    def __len__(			self    )  ->       int:
         return len(self._stacka    ) + len(self._stacka    )






    def __repr__(			self    )  ->       str:
         return f'Queue({tuple(self._stacka[::-1] + self._stacka    )})'






    def _a					(			self					,   A_    )  ->       None:
         self._stacka.append(A_    )






    def _a					(			self    )  ->       _T:
         __UpperCamelCase    							=self._stacka.pop
         __UpperCamelCase    							=self._stacka.append

         if not self._stacka:
              while self._stacka:
                   stacka_append(stacka_pop()    )

         if not self._stacka:
              raise IndexError('Queue is empty'    )
         return self._stacka.pop()


if __name__ == "__main__":
   from doctest import testmod

   testmod()








'''simple docstring'''






import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline


@pytest.mark.integration
def 		_A     (    ):






 """simple docstring"""



 with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT      ):
  with pytest.raises(A__      ):
   requests.request('''GET'''     ,				'''https://huggingface.co'''      )
  with pytest.raises(requests.exceptions.ConnectTimeout      ):
   requests.request('''GET'''     ,				'''https://huggingface.co'''     ,				timeout=1.0      )


@pytest.mark.integration
def 		_A     (    ):






 """simple docstring"""



 with offline(OfflineSimulationMode.CONNECTION_FAILS      ):
  with pytest.raises(requests.exceptions.ConnectionError      ):
   requests.request('''GET'''     ,				'''https://huggingface.co'''      )






def 		_A     (    ):






 """simple docstring"""



 with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1      ):
  with pytest.raises(A__      ):
   http_head('''https://huggingface.co'''      )

