

'''simple docstring'''

import enum
import inspect
import warnings
from functools import wraps
from typing import Callable, Optional

from .logging import get_logger


A_      =							set()
A_      =							get_logger(__name__)





def 				A_					(	snake_case = None	):

  def decorator(snake_case	):
    global _emitted_deprecation_warnings

    if inspect.isclass(snake_case	):
      SCREAMING_SNAKE_CASE:Optional[int]   =   deprecated_class_or_function.__init__
      SCREAMING_SNAKE_CASE:Any   =   deprecated_class_or_function.__name__
    else:
      SCREAMING_SNAKE_CASE:Optional[Any]   =   deprecated_class_or_function
      SCREAMING_SNAKE_CASE:int   =   deprecated_function.__name__
      # Support deprecating __init__ class method: class name instead
      SCREAMING_SNAKE_CASE:List[str]   =   name if name != "__init__" else deprecated_function.__qualname__.split("."	)[-2]

    SCREAMING_SNAKE_CASE:int   =   (
        F'''{name} is deprecated and will be removed in the next major version of datasets.''' + F''' {help_message}'''
        if help_message
        else ""
    )

    @wraps(snake_case	)
    def wrapper(*snake_case ,    **snake_case	):
      SCREAMING_SNAKE_CASE:List[Any]   =   hash(snake_case	)
      if func_hash not in _emitted_deprecation_warnings:
        warnings.warn(snake_case ,    category=snake_case ,    stacklevel=2	)
        _emitted_deprecation_warnings.add(snake_case	)
      return deprecated_function(*snake_case ,    **snake_case	)

    SCREAMING_SNAKE_CASE:List[str]   =   "deprecated"

    if inspect.isclass(snake_case	):
      SCREAMING_SNAKE_CASE:List[Any]   =   wrapper
      return deprecated_class_or_function
    else:
      return wrapper

  return decorator





class 							_snake_case	(    enum.EnumMeta  ):
   def __getattribute__(	cls     : Union[str, Any]       ,SCREAMING_SNAKE_CASE__     : Optional[int]							):
     SCREAMING_SNAKE_CASE:Optional[int]   =   super().__getattribute__(SCREAMING_SNAKE_CASE__							)
     if isinstance(SCREAMING_SNAKE_CASE__       ,enum.Enum							) and obj._on_access:
       obj._on_access()
     return obj
   def __getitem__(	cls     : int       ,SCREAMING_SNAKE_CASE__     : str							):
     SCREAMING_SNAKE_CASE:Dict   =   super().__getitem__(SCREAMING_SNAKE_CASE__							)
     if member._on_access:
       member._on_access()
     return member







   def __call__(	cls     : Any       ,SCREAMING_SNAKE_CASE__     : Any       ,SCREAMING_SNAKE_CASE__     : List[Any]=None       ,*, SCREAMING_SNAKE_CASE__     : List[Any]=None       ,SCREAMING_SNAKE_CASE__     : Tuple=None       ,SCREAMING_SNAKE_CASE__     : List[Any]=None       ,SCREAMING_SNAKE_CASE__     : List[str]=1							):
     SCREAMING_SNAKE_CASE:Dict   =   super().__call__(SCREAMING_SNAKE_CASE__       ,SCREAMING_SNAKE_CASE__       ,module=SCREAMING_SNAKE_CASE__       ,qualname=SCREAMING_SNAKE_CASE__       ,type=SCREAMING_SNAKE_CASE__       ,start=SCREAMING_SNAKE_CASE__							)
     if isinstance(SCREAMING_SNAKE_CASE__       ,enum.Enum							) and obj._on_access:
       obj._on_access()
     return obj





class 							_snake_case	(    enum.Enum		,					metaclass=_a  ):
   def __new__(	cls     : Dict       ,SCREAMING_SNAKE_CASE__     : str							):
     SCREAMING_SNAKE_CASE:int   =   object.__new__(cls							)
     SCREAMING_SNAKE_CASE:List[str]   =   value
     SCREAMING_SNAKE_CASE:int   =   member.deprecate
     return member
   @property
   def       __UpperCamelCase  (	self     : int							):
     return ""







   def       __UpperCamelCase  (	self     : Dict							):
     SCREAMING_SNAKE_CASE:Union[str, Any]   =   F''' {self.help_message}''' if self.help_message else ""
     warnings.warn(
         F'''\'{self.__objclass__.__name__}\' is deprecated and will be removed in the next major version of datasets.'''
         + help_message       ,SCREAMING_SNAKE_CASE__       ,stacklevel=3       ,)









'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


A_      =							{"configuration_yoso": ["YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP", "YosoConfig"]}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    A_      =							[
        "YOSO_PRETRAINED_MODEL_ARCHIVE_LIST",
        "YosoForMaskedLM",
        "YosoForMultipleChoice",
        "YosoForQuestionAnswering",
        "YosoForSequenceClassification",
        "YosoForTokenClassification",
        "YosoLayer",
        "YosoModel",
        "YosoPreTrainedModel",
    ]


if TYPE_CHECKING:
    from .configuration_yoso import YOSO_PRETRAINED_CONFIG_ARCHIVE_MAP, YosoConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_yoso import (
            YOSO_PRETRAINED_MODEL_ARCHIVE_LIST,
            YosoForMaskedLM,
            YosoForMultipleChoice,
            YosoForQuestionAnswering,
            YosoForSequenceClassification,
            YosoForTokenClassification,
            YosoLayer,
            YosoModel,
            YosoPreTrainedModel,
        )


else:
    import sys

    A_      =							_LazyModule(__name__, globals()["__file__"], _import_structure)






