
'''simple docstring'''


import os
from collections import namedtuple

import pytest

from datasets import ClassLabel, Features, Sequence, Value
from datasets.commands.test import TestCommand
from datasets.info import DatasetInfo, DatasetInfosDict


snake_case_			:	Any 	=       namedtuple(
    '_TestCommandArgs',
    [
        'dataset',
        'name',
        'cache_dir',
        'data_dir',
        'all_configs',
        'save_infos',
        'ignore_verifications',
        'force_redownload',
        'clear_cache',
    ],
    defaults=[None, None, None, False, False, False, False, False],
)



def 			__snake_case  (     _UpperCAmelCase       :							Tuple,   _UpperCAmelCase       :							Optional[Any]):
   return (abs(source - target) / target) < 0.0_1



@pytest.mark.integration
def 			__snake_case  (     _UpperCAmelCase       :							Tuple):
   UpperCamelCase	  =	_TestCommandArgs(dataset=_UpperCAmelCase,   all_configs=_UpperCAmelCase,   save_infos=_UpperCAmelCase)
   UpperCamelCase	  =	TestCommand(*_UpperCAmelCase)
   test_command.run()
   UpperCamelCase	  =	os.path.join(_UpperCAmelCase,   '''README.md''')
   assert os.path.exists(_UpperCAmelCase)
   UpperCamelCase	  =	DatasetInfosDict.from_directory(_UpperCAmelCase)
   UpperCamelCase	  =	DatasetInfosDict(
       {
           '''default''': DatasetInfo(
               features=Features(
                   {
                       '''tokens''': Sequence(Value('''string''')),
                       '''ner_tags''': Sequence(
                           ClassLabel(names=['''O''', '''B-PER''', '''I-PER''', '''B-ORG''', '''I-ORG''', '''B-LOC''', '''I-LOC'''])),
                       '''langs''': Sequence(Value('''string''')),
                       '''spans''': Sequence(Value('''string''')),
                   }),   splits=[
                   {
                       '''name''': '''train''',
                       '''num_bytes''': 235_1563,
                       '''num_examples''': 1_0000,
                   },
                   {
                       '''name''': '''validation''',
                       '''num_bytes''': 23_8418,
                       '''num_examples''': 1000,
                   },
               ],   download_size=394_0680,   dataset_size=258_9981,   )
       })
   assert dataset_infos.keys() == expected_dataset_infos.keys()
   for key in DatasetInfo._INCLUDED_INFO_IN_YAML:
      UpperCamelCase	  =	getattr(dataset_infos['''default'''],   _UpperCAmelCase), getattr(expected_dataset_infos['''default'''],   _UpperCAmelCase)
      if key == "num_bytes":
         assert is_apercent_close(_UpperCAmelCase,   _UpperCAmelCase)
      elif key == "splits":
         assert list(_UpperCAmelCase) == list(_UpperCAmelCase)
         for split in result:
            assert result[split].name == expected[split].name
            assert result[split].num_examples == expected[split].num_examples
            assert is_apercent_close(result[split].num_bytes,   expected[split].num_bytes)
      else:
         result == expected













'''simple docstring'''





_UpperCamelCase						:						List[str]  =					[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100_000)]
def __UpperCAmelCase   (					A					:			int		)    ->   int:
			UpperCAmelCase_      :       str          =       0
			while number:
						# Increased Speed Slightly by checking every 5 digits together.
						sum_of_digits_squared += DIGITS_SQUARED[number % 1_0_0_0_0_0]
						number //= 1_0_0_0_0_0

			return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
_UpperCamelCase						:						list[bool | None]  =					[None] * 10_000_000
_UpperCamelCase						:						List[str]  =					True
_UpperCamelCase						:						Tuple  =					False
def __UpperCAmelCase   (					A					:			int		)    ->   bool:

			if CHAINS[number - 1] is not None:
						return CHAINS[number - 1]  # type: ignore

			UpperCAmelCase_      :       Dict          =       chain(next_number(A		)		)
			UpperCAmelCase_      :       int          =       number_chain

			while number < 1_0_0_0_0_0_0_0:
						UpperCAmelCase_      :       Optional[Any]          =       number_chain
						number *= 1_0

			return number_chain
def __UpperCAmelCase   (					A					:			int = 1_0_0_0_0_0_0_0		)    ->   int:
			for i in range(1			,       A		):
						if CHAINS[i] is None:
									chain(i + 1		)

			return CHAINS[:number].count(A		)


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						print(f'''{solution() = }''')


