



"""simple docstring"""






import importlib.metadata
import subprocess
import sys






def 	snake_case__  (						__lowerCamelCase							:       bool = False      ):
			"""simple docstring"""
			lowerCamelCase__						:						Union[str, Any]						      =False
			if "IPython" in sys.modules:
						lowerCamelCase__						:						Dict						      ='''google.colab''' in str(sys.modules['''IPython'''].get_ipython()      )

			if in_colab:
						if upgrade:
									lowerCamelCase__						:						int						      =['''pip''', '''install''', '''-U''', '''torch''']
									subprocess.run(__lowerCamelCase				,						check=__lowerCamelCase      )
						# get the current version of torch
						lowerCamelCase__						:						Any						      =importlib.metadata.version('''torch'''      )
						lowerCamelCase__						:						List[str]						      =torch_version[: torch_version.rindex('''.'''      )]
						lowerCamelCase__						:						str						      =f'''https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'''
						lowerCamelCase__						:						int						      =['''pip''', '''install''', xla_wheel]
						subprocess.run(__lowerCamelCase				,						check=__lowerCamelCase      )
			else:
						raise RuntimeError('''`install_xla` utility works only on google colab.'''      )










'''simple docstring'''

class __magic_name__:






						def __init__(   self						:						List[Any]       ):



									'''simple docstring'''






									snake_case__          =						[]
									snake_case__          =						0
									snake_case__          =						0






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



									'''simple docstring'''






									snake_case__          =						"""<""" + str(self.entries       )[1:-1] + """>"""
									return printed






						def       __lowerCAmelCase(   self						:						List[Any]					,   __UpperCamelCase						:						List[Any]       ):



									'''simple docstring'''






									self.entries.append(__UpperCamelCase       )
									snake_case__          =						self.length + 1






						def       __lowerCAmelCase(   self						:						int       ):



									'''simple docstring'''






									snake_case__          =						self.length - 1
									snake_case__          =						self.entries[self.front]
									# self.front-=1
									# self.entries = self.entries[self.front:]
									snake_case__          =						self.entries[1:]
									return dequeued






						def       __lowerCAmelCase(   self						:						str					,   __UpperCamelCase						:						Optional[Any]       ):



									'''simple docstring'''






									for _ in range(__UpperCamelCase       ):
												self.put(self.get()       )






						def       __lowerCAmelCase(   self						:						List[Any]       ):



									'''simple docstring'''






									return self.entries[0]






						def       __lowerCAmelCase(   self						:						str       ):



									'''simple docstring'''






									return self.length