
'''simple docstring'''





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

from .logging import get_logger


SCREAMING_SNAKE_CASE    =					set()
SCREAMING_SNAKE_CASE    =					get_logger(__name__)







def snake_case_    (				lowercase__ = None		):

  def decorator(lowercase__		):
    global _emitted_deprecation_warnings

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

    UpperCAmelCase__			:				Optional[Any]												=       (
        F"""{name} is deprecated and will be removed in the next major version of datasets.""" + F""" {help_message}"""
        if help_message
        else ""
    )

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

    UpperCAmelCase__			:				Dict												=       "deprecated"

    if inspect.isclass(lowercase__		):
      UpperCAmelCase__			:				int												=       wrapper
      return deprecated_class_or_function
    else:
      return wrapper

  return decorator






class        UpperCAmelCase_       (						enum.EnumMeta							):

 '''simple docstring'''







 def __getattribute__(				cls		:     Any ,							snake_case__		:     int   ):



   '''simple docstring'''




   UpperCAmelCase__			:				str												=       super().__getattribute__(snake_case__   )
   if isinstance(snake_case__ ,							enum.Enum   ) and obj._on_access:
     obj._on_access()
   return obj







 def __getitem__(				cls		:     Dict ,							snake_case__		:     Any   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Dict												=       super().__getitem__(snake_case__   )
   if member._on_access:
     member._on_access()
   return member







 def __call__(				cls		:     Tuple ,							snake_case__		:     Dict ,							snake_case__		:     Union[str, Any]=None ,							*, snake_case__		:     List[str]=None ,							snake_case__		:     Dict=None ,							snake_case__		:     Optional[int]=None ,							snake_case__		:     List[str]=1   ):



   '''simple docstring'''




   UpperCAmelCase__			:				List[Any]												=       super().__call__(snake_case__ ,							snake_case__ ,							module=snake_case__ ,							qualname=snake_case__ ,							type=snake_case__ ,							start=snake_case__   )
   if isinstance(snake_case__ ,							enum.Enum   ) and obj._on_access:
     obj._on_access()
   return obj






class        UpperCAmelCase_       (						enum.Enum				,							metaclass=A							):

 '''simple docstring'''







 def __new__(				cls		:     Union[str, Any] ,							snake_case__		:     int   ):



   '''simple docstring'''




   UpperCAmelCase__			:				Dict												=       object.__new__(cls   )
   UpperCAmelCase__			:				int												=       value
   UpperCAmelCase__			:				Union[str, Any]												=       member.deprecate
   return member







 @property
 def        UpperCamelCase     (				self		:     Tuple   ):



   '''simple docstring'''




   return ""







 def        UpperCamelCase     (				self		:     Any   ):



   '''simple docstring'''




   UpperCAmelCase__			:				int												=       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 ,							snake_case__ ,							stacklevel=3 ,							)





'''simple docstring'''





from typing import TYPE_CHECKING

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


SCREAMING_SNAKE_CASE    =					{
    """configuration_donut_swin""": ["""DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DonutSwinConfig"""],
    """processing_donut""": ["""DonutProcessor"""],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE    =					[
          """DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """DonutSwinModel""",
          """DonutSwinPreTrainedModel""",
      ]

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE    =					["""DonutFeatureExtractor"""]
      SCREAMING_SNAKE_CASE    =					["""DonutImageProcessor"""]


if TYPE_CHECKING:
      from .configuration_donut_swin import DONUT_SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP, DonutSwinConfig
      from .processing_donut import DonutProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_donut_swin import (
                DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST,
                DonutSwinModel,
                DonutSwinPreTrainedModel,
            )

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_donut import DonutFeatureExtractor
            from .image_processing_donut import DonutImageProcessor

else:
      import sys

      SCREAMING_SNAKE_CASE    =					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



