

'''simple docstring'''

import inspect
import os
import unittest
from pathlib import Path

import torch

import accelerate
from accelerate.test_utils import execute_subprocess_async
from accelerate.test_utils.testing import run_command


class 	lowerCAmelCase  (   unittest.TestCase ):
       lowerCAmelCase_												=			inspect.getfile(accelerate.test_utils )
       lowerCAmelCase_												=			os.path.sep.join(mod_file.split(os.path.sep )[:-1] + ["scripts", "test_cli.py"] )

       lowerCAmelCase_												=			["accelerate", "launch"]
       lowerCAmelCase_												=			Path.home() / ".cache/huggingface/accelerate"
       lowerCAmelCase_												=			"default_config.yaml"
       lowerCAmelCase_												=			config_folder / config_file
       lowerCAmelCase_												=			config_folder / "_default_config.yaml"

       lowerCAmelCase_												=			Path("tests/test_configs" )







       @classmethod
       def       snake_case (				cls      :			Any   ):







            """simple docstring"""







            if cls.config_path.is_file():
                 cls.config_path.rename(cls.changed_path   )







       @classmethod
       def       snake_case (				cls      :			Any   ):







            """simple docstring"""







            if cls.changed_path.is_file():
                 cls.changed_path.rename(cls.config_path   )







       def       snake_case (				self      :			Any   ):







            """simple docstring"""







            __lowercase      		=self.base_cmd
            if torch.cuda.is_available() and (torch.cuda.device_count() > 1):
                 cmd += ["--multi_gpu"]
            execute_subprocess_async(cmd + [self.test_file_path]    ,   env=os.environ.copy()   )







       def       snake_case (				self      :			Tuple   ):







            """simple docstring"""







            for config in sorted(self.test_config_path.glob('**/*.yaml'   )   ):
                 with self.subTest(config_file=_lowercase   ):
                      execute_subprocess_async(
                          self.base_cmd + ['--config_file', str(_lowercase   ), self.test_file_path]    ,   env=os.environ.copy()   )







       def       snake_case (				self      :			str   ):







            """simple docstring"""







            execute_subprocess_async(['accelerate', 'test']    ,   env=os.environ.copy()   )






class 	lowerCAmelCase  (   unittest.TestCase ):
       lowerCAmelCase_												=			"test-tpu"
       lowerCAmelCase_												=			"us-central1-a"
       lowerCAmelCase_												=			"ls"
       lowerCAmelCase_												=			["accelerate", "tpu-config"]
       lowerCAmelCase_												=			"cd /usr/share"
       lowerCAmelCase_												=			"tests/test_samples/test_command_file.sh"
       lowerCAmelCase_												=			"Running gcloud compute tpus tpu-vm ssh"







       def       snake_case (				self      :			Optional[Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + ['--command', self.command, '--tpu_zone', self.tpu_zone, '--tpu_name', self.tpu_name, '--debug']    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			Union[str, Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + [
                    '--config_file',
                    'tests/test_configs/0_12_0.yaml',
                    '--command',
                    self.command,
                    '--tpu_zone',
                    self.tpu_zone,
                    '--tpu_name',
                    self.tpu_name,
                    '--debug',
                ]    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			List[Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd + ['--config_file', 'tests/test_configs/latest.yaml', '--debug']    ,   return_stdout=_lowercase   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			Optional[Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd + ['--config_file', 'tests/test_configs/latest.yaml', '--command', self.command, '--debug']    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			Union[str, Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + [
                    '--config_file',
                    'tests/test_configs/latest.yaml',
                    '--command',
                    self.command,
                    '--command',
                    'echo "Hello World"',
                    '--debug',
                ]    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls; echo \"Hello World\" --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			List[Any]   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + ['--config_file', 'tests/test_configs/latest.yaml', '--command_file', self.command_file, '--debug']    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			str   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + [
                    '--config_file',
                    'tests/test_configs/0_12_0.yaml',
                    '--command_file',
                    self.command_file,
                    '--tpu_zone',
                    self.tpu_zone,
                    '--tpu_name',
                    self.tpu_name,
                    '--debug',
                ]    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			Tuple   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd + ['--config_file', 'tests/test_configs/latest.yaml', '--install_accelerate', '--debug']    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate -U; echo \"hello world\"; echo \"this is a second command\" --worker all'''    ,   _lowercase    ,   )







       def       snake_case (				self      :			Any   ):







            """simple docstring"""







            __lowercase      		=run_command(
                self.cmd
                + [
                    '--config_file',
                    'tests/test_configs/latest.yaml',
                    '--install_accelerate',
                    '--accelerate_version',
                    '12.0.0',
                    '--debug',
                ]    ,   return_stdout=_lowercase    ,   )
            self.assertIn(
                f'''{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate==12.0.0; echo \"hello world\"; echo \"this is a second command\" --worker all'''    ,   _lowercase    ,   )





'''simple docstring'''

def 							_UpperCamelCase				(   lowerCAmelCase__:					int = 1000   )      -> int:
							SCREAMING_SNAKE_CASE_				=				2**power
							SCREAMING_SNAKE_CASE_				=				str(lowerCAmelCase__   )
							SCREAMING_SNAKE_CASE_				=				list(lowerCAmelCase__   )
							SCREAMING_SNAKE_CASE_				=				0

							for i in list_num:
														sum_of_num += int(lowerCAmelCase__   )

							return sum_of_num


if __name__ == "__main__":
							SCREAMING_SNAKE_CASE							:				Tuple     	=			int(input("Enter the power of 2: ").strip())
							print("2 ^ ", power, " = ", 2**power)
							SCREAMING_SNAKE_CASE							:				str     	=			solution(power)
							print("Sum of the digits is: ", result)





