



"""simple docstring"""







from .imports import is_tqdm_available


if is_tqdm_available():
			from tqdm.auto import tqdm as _tqdm

from ..state import PartialState

def       _lowerCamelCase				(							UpperCAmelCase_ :       bool = True,	*UpperCAmelCase_ :       List[Any],	**UpperCAmelCase_ :       List[Any]     )	-> Any:






	"""simple docstring"""





	if not is_tqdm_available():
		raise ImportError("Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."     )
	A__											=					False
	if main_process_only:
		A__											=					PartialState().local_process_index == 0
	return _tqdm(*UpperCAmelCase_,	**UpperCAmelCase_,	disable=UpperCAmelCase_     )












import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline

@pytest.mark.integration
def   __lowercase       (			):







				"""simple docstring"""






				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   __lowercase       (			):







				"""simple docstring"""






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

def   __lowercase       (			):







				"""simple docstring"""






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






