





import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline






@pytest.mark.integration
def lowerCamelCase__   (							)				->    List[Any]:
   with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT	):
      with pytest.raises(snake_case_	):
         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 lowerCamelCase__   (							)				->    List[str]:
   with offline(OfflineSimulationMode.CONNECTION_FAILS	):
      with pytest.raises(requests.exceptions.ConnectionError	):
         requests.request('''GET'''	,				'''https://huggingface.co'''	)







def lowerCamelCase__   (							)				->    Dict:
   with offline(OfflineSimulationMode.HF_DATASETS_OFFLINE_SET_TO_1	):
      with pytest.raises(snake_case_	):
         http_head('''https://huggingface.co'''	)








class 		SCREAMING_SNAKE_CASE__    :


      def __init__(self	:				str    ,      a__	:				list				):





         """simple docstring"""



         __snake_case								=       set_counts
         __snake_case								=       max(a__				)
         __snake_case								=       len(a__				)
         __snake_case								=       [1] * num_sets
         __snake_case								=       list(range(a__				)				)


      def        a			(self	:				str    ,      a__	:				int    ,      a__	:				int				):





         """simple docstring"""



         __snake_case								=       self.get_parent(a__				)
         __snake_case								=       self.get_parent(a__				)

         if src_parent == dst_parent:
            return False

         if self.ranks[dst_parent] >= self.ranks[src_parent]:
            self.set_counts[dst_parent] += self.set_counts[src_parent]
            __snake_case								=       0
            __snake_case								=       dst_parent
            if self.ranks[dst_parent] == self.ranks[src_parent]:
               self.ranks[dst_parent] += 1
            __snake_case								=       self.set_counts[dst_parent]
         else:
            self.set_counts[src_parent] += self.set_counts[dst_parent]
            __snake_case								=       0
            __snake_case								=       src_parent
            __snake_case								=       self.set_counts[src_parent]

         __snake_case								=       max(self.max_set    ,      a__				)
         return True


      def        a			(self	:				Union[str, Any]    ,      a__	:				int				):





         """simple docstring"""



         if self.parents[disj_set] == disj_set:
            return disj_set
         __snake_case								=       self.get_parent(self.parents[disj_set]				)
         return self.parents[disj_set]

