





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

from .logging import get_logger


UpperCAmelCase__    :      Union[str, Any]       					=set()
UpperCAmelCase__    :      List[Any]       					=get_logger(__name__)





def   _lowercase       (    _UpperCAmelCase = None					)    ->	Union[str, Any]:

				def decorator(_UpperCAmelCase					):
								global _emitted_deprecation_warnings

								if inspect.isclass(_UpperCAmelCase					):
												lowerCamelCase									=deprecated_class_or_function.__init__
												lowerCamelCase									=deprecated_class_or_function.__name__
								else:
												lowerCamelCase									=deprecated_class_or_function
												lowerCamelCase									=deprecated_function.__name__
												# Support deprecating __init__ class method: class name instead
												lowerCamelCase									=name if name != """__init__""" else deprecated_function.__qualname__.split("""."""					)[-2]

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

								@wraps(_UpperCAmelCase					)
								def wrapper(*_UpperCAmelCase      ,   **_UpperCAmelCase					):
												lowerCamelCase									=hash(_UpperCAmelCase					)
												if func_hash not in _emitted_deprecation_warnings:
																warnings.warn(_UpperCAmelCase      ,   category=_UpperCAmelCase      ,   stacklevel=2					)
																_emitted_deprecation_warnings.add(_UpperCAmelCase					)
												return deprecated_function(*_UpperCAmelCase      ,   **_UpperCAmelCase					)

								lowerCamelCase									="""deprecated"""

								if inspect.isclass(_UpperCAmelCase					):
												lowerCamelCase									=wrapper
												return deprecated_class_or_function
								else:
												return wrapper

				return decorator

class    __A  (    enum.EnumMeta     ):


				def __getattribute__(		cls ,			UpperCAmelCase_				):
								lowerCamelCase									=super().__getattribute__(UpperCAmelCase_				)
								if isinstance(UpperCAmelCase_ ,			enum.Enum				) and obj._on_access:
												obj._on_access()
								return obj


				def __getitem__(		cls ,			UpperCAmelCase_				):
								lowerCamelCase									=super().__getitem__(UpperCAmelCase_				)
								if member._on_access:
												member._on_access()
								return member


				def __call__(		cls ,			UpperCAmelCase_ ,			UpperCAmelCase_=None ,			*, UpperCAmelCase_=None ,			UpperCAmelCase_=None ,			UpperCAmelCase_=None ,			UpperCAmelCase_=1				):
								lowerCamelCase									=super().__call__(UpperCAmelCase_ ,			UpperCAmelCase_ ,			module=UpperCAmelCase_ ,			qualname=UpperCAmelCase_ ,			type=UpperCAmelCase_ ,			start=UpperCAmelCase_				)
								if isinstance(UpperCAmelCase_ ,			enum.Enum				) and obj._on_access:
												obj._on_access()
								return obj




class    __A  (    enum.Enum     ,       metaclass=a     ):


				def __new__(		cls ,			UpperCAmelCase_				):
								lowerCamelCase									=object.__new__(cls				)
								lowerCamelCase									=value
								lowerCamelCase									=member.deprecate
								return member


				@property
				def _snake_case							(		self				):
								return ""


				def _snake_case							(		self				):
								lowerCamelCase									=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 ,			UpperCAmelCase_ ,			stacklevel=3 ,			)












from typing import TYPE_CHECKING

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


UpperCAmelCase__    :      Optional[Any]       					={
    '''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:
							UpperCAmelCase__    :      Any       					=[
							    '''DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''DonutSwinModel''',
							    '''DonutSwinPreTrainedModel''',
							]

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__    :      Tuple       					=['''DonutFeatureExtractor''']
							UpperCAmelCase__    :      List[str]       					=['''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

							UpperCAmelCase__    :      int       					=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





