





'''simple docstring'''

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


a        =						re.compile(r"^(?P<major>\d+)" r"\.(?P<minor>\d+)" r"\.(?P<patch>\d+)$")







@total_ordering
@dataclass
class __a :
   __UpperCamelCase   : str
   __UpperCamelCase   : Optional[str]	      =	None
   __UpperCamelCase   : Optional[Union[str, int]]	      =	None
   __UpperCamelCase   : Optional[Union[str, int]]	      =	None
   __UpperCamelCase   : Optional[Union[str, int]]	      =	None





   def      UpperCAmelCase__     (					self				:			Tuple    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE							,     __SCREAMING_SNAKE_CASE							,     __SCREAMING_SNAKE_CASE      							=       _str_to_version_tuple(self.version_str    )





   def __repr__(					self				:			Tuple    ):

      '''simple docstring'''

      return f"""{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}"""





   @property
   def      UpperCAmelCase__     (					self				:			int    ):

      '''simple docstring'''

      return self.major, self.minor, self.patch





   def      UpperCAmelCase__     (					self				:			Union[str, Any]				,lowerCamelCase				:			Any    ):

      '''simple docstring'''

      if isinstance(lowerCamelCase				,lowerCamelCase    ):
         return Version(lowerCamelCase    )
      elif isinstance(lowerCamelCase				,lowerCamelCase    ):
         return other
      raise TypeError(f"""{other} (type {type(lowerCamelCase    )}) cannot be compared to version."""    )





   def __eq__(					self				:			int				,lowerCamelCase				:			Union[str, Any]    ):

      '''simple docstring'''

      try:
         __SCREAMING_SNAKE_CASE      							=       self._validate_operand(lowerCamelCase    )
      except (TypeError, ValueError):
         return False
      else:
         return self.tuple == other.tuple





   def __lt__(					self				:			Any				,lowerCamelCase				:			int    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       self._validate_operand(lowerCamelCase    )
      return self.tuple < other.tuple





   def __hash__(					self				:			List[Any]    ):

      '''simple docstring'''

      return hash(_version_tuple_to_str(self.tuple    )    )





   @classmethod
   def      UpperCAmelCase__     (					cls				:			Union[str, Any]				,lowerCamelCase				:			Optional[Any]    ):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE      							=       {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				:			List[Any]    ):

      '''simple docstring'''

      return self.version_str





def 						__magic_name__       (							__UpperCAmelCase      )						->					Tuple:

   '''simple docstring'''







   __SCREAMING_SNAKE_CASE      							=       _VERSION_REG.match(__UpperCAmelCase      )
   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(__UpperCAmelCase      ) for v in [res.group("""major"""      ), res.group("""minor"""      ), res.group("""patch"""      )]      )







def 						__magic_name__       (							__UpperCAmelCase      )						->					Union[str, Any]:

   '''simple docstring'''







   return ".".join(str(__UpperCAmelCase      ) for v in version_tuple      )












'''simple docstring'''

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

a        =						[
    "python",
    "tqdm",
    "regex",
    "requests",
    "packaging",
    "filelock",
    "numpy",
    "tokenizers",
    "huggingface-hub",
    "safetensors",
    "accelerate",
    "pyyaml",
]

for pkg in pkgs_to_check_at_runtime:
    if pkg in deps:
        if pkg == "tokenizers":
            # must be loaded here, or else tqdm check may fail
            from .utils import is_tokenizers_available

            if not is_tokenizers_available():
                continue  # not required, check version only if installed
        elif pkg == "accelerate":
            # must be loaded here, or else tqdm check may fail
            from .utils import is_accelerate_available

            # Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of
            # Transformers with PyTorch
            if not is_accelerate_available():
                continue  # not required, check version only if installed

        require_version_core(deps[pkg])
    else:
        raise ValueError(F'''can\'t find {pkg} in {deps.keys()}, check dependency_versions_table.py''')

def 						__magic_name__       (							__UpperCAmelCase							,	__UpperCAmelCase=None      )						->					Optional[Any]:

   '''simple docstring'''







   require_version(deps[pkg]							,	__UpperCAmelCase      )





