'''simple docstring'''






# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


_UpperCAmelCase    :     str         =       re.compile(r'''^(?P<major>\d+)''' r'''\.(?P<minor>\d+)''' r'''\.(?P<patch>\d+)$''')







@total_ordering
@dataclass
class lowercase_       :







   """simple docstring"""

   __lowerCAmelCase         =   42
   __lowerCAmelCase         =   None
   __lowerCAmelCase         =   None
   __lowerCAmelCase         =   None
   __lowerCAmelCase         =   None
   def 	__UpperCAmelCase   (      self      :			int     )  ->			Tuple:
        _A		,       _A		,       _A    		=  _str_to_version_tuple(self.version_str     )
   def __repr__(      self      :			List[str]     )  ->			List[Any]:
        return f'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'
   @property
   def 	__UpperCAmelCase   (      self      :			List[Any]     )  ->			Any:
        return self.major, self.minor, self.patch
   def 	__UpperCAmelCase   (      self      :			List[str], UpperCamelCase__      :			List[str]     )  ->			Dict:
        if isinstance(UpperCamelCase__, UpperCamelCase__     ):
             return Version(UpperCamelCase__     )
        elif isinstance(UpperCamelCase__, UpperCamelCase__     ):
             return other
        raise TypeError(f'{other} (type {type(UpperCamelCase__     )}) cannot be compared to version.'     )
   def __eq__(      self      :			str, UpperCamelCase__      :			List[Any]     )  ->			Union[str, Any]:
        try:
             _A    		=  self._validate_operand(UpperCamelCase__     )
        except (TypeError, ValueError):
             return False
        else:
             return self.tuple == other.tuple
   def __lt__(      self      :			Optional[Any], UpperCamelCase__      :			Dict     )  ->			Union[str, Any]:
        _A    		=  self._validate_operand(UpperCamelCase__     )
        return self.tuple < other.tuple
   def __hash__(      self      :			str     )  ->			Optional[int]:
        return hash(_version_tuple_to_str(self.tuple     )     )
   @classmethod
   def 	__UpperCAmelCase   (      cls      :			int, UpperCamelCase__      :			str     )  ->			List[Any]:
        _A    		=  {f.name for f in dataclasses.fields(cls     )}
        return cls(**{k: v for k, v in dic.items() if k in field_names}     )

   def 	__UpperCAmelCase   (      self      :			Tuple     )  ->			str:
        return self.version_str






def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Any				):
     _A    		=  _VERSION_REG.match(__snake_case				)
     if not res:
          raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'				)
     return tuple(int(__snake_case				) for v in [res.group('major'				), res.group('minor'				), res.group('patch'				)]				)





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Union[str, Any]				):
     return ".".join(str(__snake_case				) for v in version_tuple				)




'''simple docstring'''






import pytest
import requests

from datasets.utils.file_utils import http_head

from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline





@pytest.mark.integration
def  _SCREAMING_SNAKE_CASE		(      ):
     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  _SCREAMING_SNAKE_CASE		(      ):
     with offline(OfflineSimulationMode.CONNECTION_FAILS				):
          with pytest.raises(requests.exceptions.ConnectionError				):
               requests.request('GET'   ,		'https://huggingface.co'				)





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



