


'''simple docstring'''






import inspect
import os
import sys
import unittest

import accelerate
from accelerate.test_utils import execute_subprocess_async, require_tpu




class 	a__       (							unittest.TestCase						):





		'''simple docstring'''






		def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Dict:
									lowerCAmelCase__      =			inspect.getfile(accelerate.test_utils     )
									lowerCAmelCase__      =			os.path.sep.join(mod_file.split(os.path.sep     )[:-1] + ['''scripts''', '''test_script.py''']     )
									lowerCAmelCase__      =			os.path.sep.join(inspect.getfile(self.__class__     ).split(os.path.sep     )[:-1]     )







		@require_tpu
		def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							int:
									lowerCAmelCase__      =			F"""
            {self.test_dir}/xla_spawn.py
            --num_cores 8
            {self.test_file_path}
        """.split()
									lowerCAmelCase__      =			[sys.executable] + distributed_args
									execute_subprocess_async(lowerCamelCase_      ,					env=os.environ.copy()     )



'''simple docstring'''






def       _snake_case     (  A )		->					bool:
							if not isinstance(A				,					A ):
														raise ValueError('''Input series is not valid, valid series - [2, 4, 6]''' )
							if len(A ) == 0:
														raise ValueError('''Input list must be a non empty list''' )
							if len(A ) == 1:
														return True
							lowerCAmelCase__      =			series[1] - series[0]
							for index in range(len(A ) - 1 ):
														if series[index + 1] - series[index] != common_diff:
																					return False
							return True


def       _snake_case     (  A )		->					float:
							if not isinstance(A				,					A ):
														raise ValueError('''Input series is not valid, valid series - [2, 4, 6]''' )
							if len(A ) == 0:
														raise ValueError('''Input list must be a non empty list''' )
							lowerCAmelCase__      =			0
							for val in series:
														answer += val
							return answer / len(A )


if __name__ == "__main__":
		import doctest

		doctest.testmod()