"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase__  		=						{
    """configuration_table_transformer""": [
        """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """TableTransformerConfig""",
        """TableTransformerOnnxConfig""",
    ]
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCAmelCase__  		=						[
        """TABLE_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TableTransformerForObjectDetection""",
        """TableTransformerModel""",
        """TableTransformerPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_table_transformer import (
        TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
        TableTransformerConfig,
        TableTransformerOnnxConfig,
    )

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_table_transformer import (
            TABLE_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            TableTransformerForObjectDetection,
            TableTransformerModel,
            TableTransformerPreTrainedModel,
        )

else:
    import sys

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

"""simple docstring"""


def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  _UpperCAmelCase						 =      0
  while n > 0:
    res += n % 10
    n //= 10
  return res






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      abs(lowercase		)
  return n if n < 10 else n % 10 + sum_of_digits(n // 10		)






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return sum(int(lowercase		) for c in str(abs(lowercase		)		)		)






def     __UpperCAmelCase					(			):







  """simple docstring"""
  from collections.abc import Callable
  from timeit import timeit

  def benchmark_a_function(lowercase   ,lowercase		) -> None:
    _UpperCAmelCase						 =      f'''{func.__name__}({value})'''
    _UpperCAmelCase						 =      timeit(f'''__main__.{call}'''   ,setup="""import __main__"""		)
    print(f'''{call:56} = {func(lowercase		)} -- {timing:.4f} seconds'''		)

  for value in (26_21_44, 11_25_89_99_06_84_26_24, 1_26_76_50_60_02_28_22_94_01_49_67_03_20_53_76):
    for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
      benchmark_a_function(lowercase   ,lowercase		)
    print()


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()
