'''simple docstring'''


import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__lowerCAmelCase	:       str						       =	logging.getLogger()






@unittest.skip('''Temporarily disable the doc tests.'''   )
@require_torch
@require_tf
@slow
class 						A   (   unittest.TestCase   ):





							def       snake_case__						(      self				:							Optional[Any]     ,		__a				:							Path     ,		__a				:							Union[str, None] = None     ,		__a				:							Union[List[str], None] = None     ,		__a				:							Union[str, List[str], None] = None     ,		__a				:							bool = True     ,		)							->	Union[str, Any]:
								__UpperCAmelCase							=			[file for file in os.listdir(__a	) if os.path.isfile(os.path.join(__a     ,		__a	)	)]

								if identifier is not None:
									__UpperCAmelCase							=			[file for file in files if identifier in file]

								if n_identifier is not None:
									if isinstance(__a     ,		__a	):
										for n_ in n_identifier:
											__UpperCAmelCase							=			[file for file in files if n_ not in file]
									else:
										__UpperCAmelCase							=			[file for file in files if n_identifier not in file]

								__UpperCAmelCase							=			ignore_files or []
								ignore_files.append('''__init__.py'''	)
								__UpperCAmelCase							=			[file for file in files if file not in ignore_files]

								for file in files:
									# Open all files
									print('''Testing'''     ,		__a	)

									if only_modules:
										__UpperCAmelCase							=			file.split('''.'''	)[0]
										try:
											__UpperCAmelCase							=			getattr(__a     ,		__a	)
											__UpperCAmelCase							=			doctest.DocTestSuite(__a	)
											__UpperCAmelCase							=			unittest.TextTestRunner().run(__a	)
											self.assertIs(len(result.failures	)     ,		0	)
										except AttributeError:
											logger.info(f"""{module_identifier} is not a module."""	)
									else:
										__UpperCAmelCase							=			doctest.testfile(str('''..''' / directory / file	)     ,		optionflags=doctest.ELLIPSIS	)
										self.assertIs(result.failed     ,		0	)





							def       snake_case__						(      self				:							List[str]	)							->	str:
								__UpperCAmelCase							=			Path('''src/transformers'''	)
								__UpperCAmelCase							=			'''modeling'''
								__UpperCAmelCase							=			[
								    '''modeling_ctrl.py''',
								    '''modeling_tf_ctrl.py''',
								]
								self.analyze_directory(__a     ,		identifier=__a     ,		ignore_files=__a	)





							def       snake_case__						(      self				:							Optional[int]	)							->	Union[str, Any]:
								__UpperCAmelCase							=			Path('''src/transformers'''	)
								__UpperCAmelCase							=			'''tokenization'''
								self.analyze_directory(__a     ,		identifier=__a	)





							def       snake_case__						(      self				:							List[Any]	)							->	List[str]:
								__UpperCAmelCase							=			Path('''src/transformers'''	)
								__UpperCAmelCase							=			'''configuration'''
								self.analyze_directory(__a     ,		identifier=__a	)





							def       snake_case__						(      self				:							Optional[int]	)							->	int:
								__UpperCAmelCase							=			Path('''src/transformers'''	)
								__UpperCAmelCase							=			['''configuration''', '''modeling''', '''tokenization''']
								self.analyze_directory(__a     ,		n_identifier=__a	)






							def       snake_case__						(      self				:							Optional[Any]	)							->	List[str]:
								__UpperCAmelCase							=			Path('''docs/source'''	)
								__UpperCAmelCase							=			['''favicon.ico''']
								self.analyze_directory(__a     ,		ignore_files=__a     ,		only_modules=__a	)


'''simple docstring'''


from math import sqrt

import numpy as np
from sympy import symbols

# Coefficient
# Speed of light (m/s)
__lowerCAmelCase	:       str						       =	299_792_458

# Symbols
__lowerCAmelCase       ,	__lowerCAmelCase       ,	__lowerCAmelCase       ,	__lowerCAmelCase	:       Any						       =	symbols("ct x y z")





def       lowerCAmelCase					(		UpperCamelCase__				:   float       ):


	"""simple docstring"""
	if velocity > c:
		raise ValueError('''Speed must not exceed light speed 299,792,458 [m/s]!'''       )
	elif velocity < 1:
		# Usually the speed should be much higher than 1 (c order of magnitude)
		raise ValueError('''Speed must be greater than or equal to 1!'''       )

	return velocity / c





def       lowerCAmelCase					(		UpperCamelCase__				:   float       ):


	"""simple docstring"""
	return 1 / sqrt(1 - beta(UpperCamelCase__       ) ** 2       )





def       lowerCAmelCase					(		UpperCamelCase__				:   float       ):


	"""simple docstring"""
	return np.array(
	    [
	        [gamma(UpperCamelCase__       ), -gamma(UpperCamelCase__       ) * beta(UpperCamelCase__       ), 0, 0],
	        [-gamma(UpperCamelCase__       ) * beta(UpperCamelCase__       ), gamma(UpperCamelCase__       ), 0, 0],
	        [0, 0, 1, 0],
	        [0, 0, 0, 1],
	    ]       )





def       lowerCAmelCase					(		UpperCamelCase__				:   float    ,					UpperCamelCase__				:   np.ndarray | None = None       ):


	"""simple docstring"""
	# Ensure event is not empty
	if event is None:
		__UpperCAmelCase							=			np.array([ct, x, y, z]       )  # Symbolic four vector
	else:
		event[0] *= c  # x0 is ct (speed of light * time)

	return transformation_matrix(UpperCamelCase__       ) @ event


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					# Example of symbolic vector:
					__lowerCAmelCase	:       Dict						       =	transform(29_979_245)
					print("Example of four vector: ")
					print(F"""ct' = {four_vector[0]}""")
					print(F"""x' = {four_vector[1]}""")
					print(F"""y' = {four_vector[2]}""")
					print(F"""z' = {four_vector[3]}""")

					# Substitute symbols with numerical values
					__lowerCAmelCase	:       Union[str, Any]						       =	{ct: c, x: 1, y: 1, z: 1}
					__lowerCAmelCase	:       Optional[int]						       =	[four_vector[i].subs(sub_dict) for i in range(4)]

					print(F"""\n{numerical_vector}""")
