
"""simple docstring"""




import inspect
import os
import unittest

import torch

import accelerate
from accelerate import debug_launcher
from accelerate.test_utils import (
    execute_subprocess_async,
    require_cpu,
    require_multi_gpu,
    require_single_gpu,
    test_sync,
)
from accelerate.utils import patch_environment







class 						lowercase(unittest.TestCase					):



     def  lowercase__(       self      )		->    Optional[Any]:







         """simple docstring"""



         a__    = inspect.getfile(accelerate.test_utils      )
         a__    = os.path.sep.join(mod_file.split(os.path.sep      )[:-1] + ['scripts', 'test_sync.py']      )



     @require_cpu
     def  lowercase__(       self      )		->    Tuple:







         """simple docstring"""



         debug_launcher(test_sync.main    ,							num_processes=1      )



     @require_cpu
     def  lowercase__(       self      )		->    str:







         """simple docstring"""



         debug_launcher(test_sync.main      )



     @require_single_gpu
     def  lowercase__(       self      )		->    int:







         """simple docstring"""



         test_sync.main()




     @require_multi_gpu
     def  lowercase__(       self      )		->    Dict:







         """simple docstring"""



         print(f'Found {torch.cuda.device_count()} devices.'      )
         a__    = ['torchrun', f'--nproc_per_node={torch.cuda.device_count()}', self.test_file_path]
         with patch_environment(omp_num_threads=1      ):
             execute_subprocess_async(__SCREAMING_SNAKE_CASE    ,							env=os.environ.copy()      )




"""simple docstring"""




a		:					str    	=					(1, 1_53, 3_70, 3_71, 16_34, 24_67_80_51, 1_15_13_22_19_01_87_63_99_25_65_09_55_97_97_39_71_52_24_01)
a		:					tuple    	=					(-1_53, -1, 0, 1.2, 2_00, "A", [], {}, None)



def 						__magic_name__		(				UpperCamelCase    :		int    )    ->	bool:
    if not isinstance(UpperCamelCase       ,		UpperCamelCase    ) or n < 1:
        return False

    # Initialization of sum and number of digits.
    a__    = 0
    a__    = 0
    a__    = n
    # Calculation of digits of the number
    while temp > 0:
        number_of_digits += 1
        temp //= 10
    # Dividing number into separate digits and find Armstrong number
    a__    = n
    while temp > 0:
        a__    = temp % 10
        total += rem**number_of_digits
        temp //= 10
    return n == total



def 						__magic_name__		(				UpperCamelCase    :		int    )    ->	bool:
    if not isinstance(UpperCamelCase       ,		UpperCamelCase    ) or n < 1:
        return False

    # Init a "histogram" of the digits
    a__    = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    a__    = 0
    a__    = 0
    a__    = n
    while temp > 0:
        a__  ,    a__    = divmod(UpperCamelCase       ,		10    )
        digit_histogram[rem] += 1
        digit_total += 1

    for cnt, i in zip(UpperCamelCase       ,		range(len(UpperCamelCase    )    )    ):
        total += cnt * i**digit_total

    return n == total



def 						__magic_name__		(				UpperCamelCase    :		int    )    ->	bool:
    if not isinstance(UpperCamelCase       ,		UpperCamelCase    ) or n < 1:
        return False
    a__    = len(str(UpperCamelCase    )    )  # the power that all digits will be raised to
    # check if sum of each digit multiplied expo times is equal to number
    return n == sum(int(UpperCamelCase    ) ** expo for i in str(UpperCamelCase    )    )



def 						__magic_name__		(				)    ->	List[Any]:
    a__    = int(input('Enter an integer to see if it is an Armstrong number: '    ).strip()    )
    print(f'{num} is {"" if armstrong_number(UpperCamelCase    ) else "not "}an Armstrong number.'    )
    print(f'{num} is {"" if narcissistic_number(UpperCamelCase    ) else "not "}an Armstrong number.'    )
    print(f'{num} is {"" if pluperfect_number(UpperCamelCase    ) else "not "}an Armstrong number.'    )


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()


