
'''simple docstring'''





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

from .logging import get_logger


UpperCAmelCase            = set()
UpperCAmelCase            = get_logger(__name__)

def   A			(							A_				:       Optional[str] = None							):

						def decorator(A_				:       Callable							):
												global _emitted_deprecation_warnings

												if inspect.isclass(A_							):
																		snake_case							:  Tuple			=     deprecated_class_or_function.__init__
																		snake_case							:  Union[str, Any]			=     deprecated_class_or_function.__name__
												else:
																		snake_case							:  Tuple			=     deprecated_class_or_function
																		snake_case							:  Dict			=     deprecated_function.__name__
																		# Support deprecating __init__ class method: class name instead
																		snake_case							:  List[Any]			=     name if name != '''__init__''' else deprecated_function.__qualname__.split('''.'''							)[-2]

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

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

												snake_case							:  int			=     '''deprecated'''

												if inspect.isclass(A_							):
																		snake_case							:  Tuple			=     wrapper
																		return deprecated_class_or_function
												else:
																		return wrapper

						return decorator

class     a (					enum.EnumMeta     ):




				def __getattribute__(				cls						:					List[str],     SCREAMING_SNAKE_CASE_						:					Union[str, Any]   ):
										snake_case							:  str			=     super().__getattribute__(SCREAMING_SNAKE_CASE_   )
										if isinstance(SCREAMING_SNAKE_CASE_,     enum.Enum   ) and obj._on_access:
																obj._on_access()
										return obj




				def __getitem__(				cls						:					Tuple,     SCREAMING_SNAKE_CASE_						:					str   ):
										snake_case							:  Union[str, Any]			=     super().__getitem__(SCREAMING_SNAKE_CASE_   )
										if member._on_access:
																member._on_access()
										return member




				def __call__(				cls						:					Union[str, Any],     SCREAMING_SNAKE_CASE_						:					Tuple,     SCREAMING_SNAKE_CASE_						:					Optional[int]=None,     *, SCREAMING_SNAKE_CASE_						:					Dict=None,     SCREAMING_SNAKE_CASE_						:					str=None,     SCREAMING_SNAKE_CASE_						:					Optional[int]=None,     SCREAMING_SNAKE_CASE_						:					Optional[int]=1   ):
										snake_case							:  str			=     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     a (					enum.Enum					,metaclass=__magic_name__     ):




				def __new__(				cls						:					Optional[int],     SCREAMING_SNAKE_CASE_						:					List[Any]   ):
										snake_case							:  Union[str, Any]			=     object.__new__(cls   )
										snake_case							:  List[str]			=     value
										snake_case							:  List[str]			=     member.deprecate
										return member




				@property
				def 						__snake_case				(				self						:					Any   ):
										return ""




				def 						__snake_case				(				self						:					int   ):
										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'''





import math
from timeit import timeit

def   A			(							A_				:       int							):
						snake_case							:  List[str]			=     0
						snake_case							:  Any			=     abs(A_							)
						while True:
												snake_case							:  List[Any]			=     n // 10
												digits += 1
												if n == 0:
																		break
						return digits

def   A			(							A_				:       int							):
						return 1 if n == 0 else math.floor(math.log(abs(A_							)     ,				10							) + 1							)

def   A			(							A_				:       int							):
						return len(str(abs(A_							)							)							)

def   A			(							):
						from collections.abc import Callable

						def benchmark_a_function(A_				:       Callable     ,				A_				:       int							) -> None:
												snake_case							:  Optional[int]			=     F"""{func.__name__}({value})"""
												snake_case							:  Optional[int]			=     timeit(F"""__main__.{call}"""     ,				setup='''import __main__'''							)
												print(F"""{call}: {func(A_							)} -- {timing} seconds"""							)

						for value in (262144, 1125899906842624, 1267650600228229401496703205376):
												for func in (num_digits, num_digits_fast, num_digits_faster):
																		benchmark_a_function(A_     ,				A_							)
												print()


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						benchmark()

