



'''simple docstring'''





import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
_lowerCAmelCase										=     sys.version_info >= (3, 10)
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase=None							,   UpperCamelCase=None      ):



				"""simple docstring"""





				return field(default_factory=lambda: default							,   metadata=UpperCamelCase      )






@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				int
		__lowercase							:				float
		__lowercase							:				str
		__lowercase							:				bool







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				int           =				4_2
		__lowercase							:				str           =				field(default='''toto'''						,			metadata={'''help''': '''help message'''}					)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				bool           =				False
		__lowercase							:				bool           =				True
		__lowercase							:				Optional[bool]           =				None







class 	lowerCAmelCase_(    lowerCAmelCase_					):
		'''simple docstring'''




		__lowercase							:				Optional[Any]           =				"""titi"""
		__lowercase							:				Dict           =				"""toto"""







class 	lowerCAmelCase_(    lowerCAmelCase_					):
		'''simple docstring'''




		__lowercase							:				Any           =				"""titi"""
		__lowercase							:				Optional[Any]           =				"""toto"""
		__lowercase							:				int           =				4_2







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				BasicEnum           =				"toto"




		def 							UpperCAmelCase_     (   self				)   ->		List[str]:
						lowerCAmelCase__			:  Any											= BasicEnum(self.foo				)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				MixedTypeEnum           =				"toto"




		def 							UpperCAmelCase_     (   self				)   ->		int:
						lowerCAmelCase__			:  List[str]											= MixedTypeEnum(self.foo				)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				Optional[int]           =				None
		__lowercase							:				Optional[float]           =				field(default=lowerCAmelCase_						,			metadata={'''help''': '''help message'''}					)
		__lowercase							:				Optional[str]           =				None
		__lowercase							:				Optional[List[str]]           =				list_field(default=[]					)
		__lowercase							:				Optional[List[int]]           =				list_field(default=[]					)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				List[int]           =				list_field(default=[]					)
		__lowercase							:				List[int]           =				list_field(default=[1, 2, 3]					)
		__lowercase							:				List[str]           =				list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']					)
		__lowercase							:				List[float]           =				list_field(default=[0.1, 0.2, 0.3]					)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				List[int]           =				field()
		__lowercase							:				str           =				field()
		__lowercase							:				BasicEnum           =				field()




		def 							UpperCAmelCase_     (   self				)   ->		Optional[Any]:
						lowerCAmelCase__			:  str											= BasicEnum(self.required_enum				)







@dataclass
class 	lowerCAmelCase_:
		'''simple docstring'''




		__lowercase							:				int
		__lowercase							:				"BasicEnum"           =				field()
		__lowercase							:				"Optional[bool]"           =				None
		__lowercase							:				"str"           =				field(default='''toto'''						,			metadata={'''help''': '''help message'''}					)
		__lowercase							:				"List[str]"           =				list_field(default=['''Hallo''', '''Bonjour''', '''Hello''']					)


if is_python_no_less_than_3_10:






	@dataclass
	class 	lowerCAmelCase_:
			'''simple docstring'''




			__lowercase							:				bool           =				False
			__lowercase							:				bool           =				True
			__lowercase							:				bool | None           =				None







	@dataclass
	class 	lowerCAmelCase_:
			'''simple docstring'''




			__lowercase							:				int | None           =				None
			__lowercase							:				float | None           =				field(default=lowerCAmelCase_						,			metadata={'''help''': '''help message'''}					)
			__lowercase							:				str | None           =				None
			__lowercase							:				list[str] | None           =				list_field(default=[]					)
			__lowercase							:				list[int] | None           =				list_field(default=[]					)






class 	lowerCAmelCase_(    unittest.TestCase					):
		'''simple docstring'''




		def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase  ,__UpperCAmelCase				)   ->		int:
						self.assertEqual(len(a._actions				)  ,len(b._actions				)				)
						for x, y in zip(a._actions  ,b._actions				):
										lowerCAmelCase__			:  List[str]											= {k: v for k, v in vars(__SCREAMING_SNAKE_CASE				).items() if k != """container"""}
										lowerCAmelCase__			:  int											= {k: v for k, v in vars(__SCREAMING_SNAKE_CASE				).items() if k != """container"""}

										# Choices with mixed type have custom function as "type"
										# So we need to compare results directly for equality
										if xx.get("""choices"""  ,__SCREAMING_SNAKE_CASE				) and yy.get("""choices"""  ,__SCREAMING_SNAKE_CASE				):
														for expected_choice in yy["choices"] + xx["choices"]:
																		self.assertEqual(xx["""type"""](__SCREAMING_SNAKE_CASE				)  ,yy["""type"""](__SCREAMING_SNAKE_CASE				)				)
														del xx["type"], yy["type"]

										self.assertEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		Optional[int]:
						lowerCAmelCase__			:  Optional[Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Dict											= argparse.ArgumentParser()
						expected.add_argument("""--foo"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--bar"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--baz"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--flag"""  ,type=__SCREAMING_SNAKE_CASE  ,default=__SCREAMING_SNAKE_CASE  ,const=__SCREAMING_SNAKE_CASE  ,nargs="""?"""				)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  str											= ["""--foo""", """1""", """--baz""", """quux""", """--bar""", """0.5"""]
						((lowerCAmelCase__	)				,       	)			:  List[str]											= parser.parse_args_into_dataclasses(__SCREAMING_SNAKE_CASE  ,look_for_args_file=__SCREAMING_SNAKE_CASE				)
						self.assertFalse(example.flag				)




		def 							UpperCAmelCase_     (   self				)   ->		Optional[Any]:
						lowerCAmelCase__			:  List[Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Dict											= argparse.ArgumentParser()
						expected.add_argument("""--foo"""  ,default=42  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--baz"""  ,default="""toto"""  ,type=__SCREAMING_SNAKE_CASE  ,help="""help message"""				)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		Any:
						lowerCAmelCase__			:  List[Any]											= argparse.ArgumentParser()
						expected.add_argument("""--foo"""  ,type=__SCREAMING_SNAKE_CASE  ,default=__SCREAMING_SNAKE_CASE  ,const=__SCREAMING_SNAKE_CASE  ,nargs="""?"""				)
						expected.add_argument("""--baz"""  ,type=__SCREAMING_SNAKE_CASE  ,default=__SCREAMING_SNAKE_CASE  ,const=__SCREAMING_SNAKE_CASE  ,nargs="""?"""				)
						# A boolean no_* argument always has to come after its "default: True" regular counter-part
						# and its default must be set to False
						expected.add_argument("""--no_baz"""  ,action="""store_false"""  ,default=__SCREAMING_SNAKE_CASE  ,dest="""baz"""				)
						expected.add_argument("""--opt"""  ,type=__SCREAMING_SNAKE_CASE  ,default=__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  List[str]											= [WithDefaultBoolExample]
						if is_python_no_less_than_3_10:
										dataclass_types.append(__SCREAMING_SNAKE_CASE				)

						for dataclass_type in dataclass_types:
										lowerCAmelCase__			:  Any											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)
										self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

										lowerCAmelCase__			:  List[str]											= parser.parse_args([]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,opt=__SCREAMING_SNAKE_CASE				)				)

										lowerCAmelCase__			:  Union[str, Any]											= parser.parse_args(["""--foo""", """--no_baz"""]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,opt=__SCREAMING_SNAKE_CASE				)				)

										lowerCAmelCase__			:  Union[str, Any]											= parser.parse_args(["""--foo""", """--baz"""]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,opt=__SCREAMING_SNAKE_CASE				)				)

										lowerCAmelCase__			:  int											= parser.parse_args(["""--foo""", """True""", """--baz""", """True""", """--opt""", """True"""]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,opt=__SCREAMING_SNAKE_CASE				)				)

										lowerCAmelCase__			:  int											= parser.parse_args(["""--foo""", """False""", """--baz""", """False""", """--opt""", """False"""]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,opt=__SCREAMING_SNAKE_CASE				)				)




		def 							UpperCAmelCase_     (   self				)   ->		Optional[int]:
						lowerCAmelCase__			:  Optional[int]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Any											= argparse.ArgumentParser()
						expected.add_argument(
						    """--foo"""  ,default="""toto"""  ,choices=["""titi""", """toto""", 42]  ,type=make_choice_type_function(["""titi""", """toto""", 42]				)  ,)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Optional[Any]											= parser.parse_args([]				)
						self.assertEqual(args.foo  ,"""toto"""				)
						lowerCAmelCase__			:  Union[str, Any]											= parser.parse_args_into_dataclasses([]				)[0]
						self.assertEqual(enum_ex.foo  ,MixedTypeEnum.toto				)

						lowerCAmelCase__			:  int											= parser.parse_args(["""--foo""", """titi"""]				)
						self.assertEqual(args.foo  ,"""titi"""				)
						lowerCAmelCase__			:  str											= parser.parse_args_into_dataclasses(["""--foo""", """titi"""]				)[0]
						self.assertEqual(enum_ex.foo  ,MixedTypeEnum.titi				)

						lowerCAmelCase__			:  Any											= parser.parse_args(["""--foo""", """42"""]				)
						self.assertEqual(args.foo  ,42				)
						lowerCAmelCase__			:  int											= parser.parse_args_into_dataclasses(["""--foo""", """42"""]				)[0]
						self.assertEqual(enum_ex.foo  ,MixedTypeEnum.fourtytwo				)




		def 							UpperCAmelCase_     (   self				)   ->		Dict:






						@dataclass
						class 	lowerCAmelCase_:
								'''simple docstring'''




								__lowercase							:				Literal["titi", "toto", 4_2]           =				"toto"







						lowerCAmelCase__			:  List[Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Any											= argparse.ArgumentParser()
						expected.add_argument(
						    """--foo"""  ,default="""toto"""  ,choices=("""titi""", """toto""", 42)  ,type=make_choice_type_function(["""titi""", """toto""", 42]				)  ,)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Optional[int]											= parser.parse_args([]				)
						self.assertEqual(args.foo  ,"""toto"""				)

						lowerCAmelCase__			:  Dict											= parser.parse_args(["""--foo""", """titi"""]				)
						self.assertEqual(args.foo  ,"""titi"""				)

						lowerCAmelCase__			:  Union[str, Any]											= parser.parse_args(["""--foo""", """42"""]				)
						self.assertEqual(args.foo  ,42				)




		def 							UpperCAmelCase_     (   self				)   ->		str:
						lowerCAmelCase__			:  str											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  str											= argparse.ArgumentParser()
						expected.add_argument("""--foo_int"""  ,nargs="""+"""  ,default=[]  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--bar_int"""  ,nargs="""+"""  ,default=[1, 2, 3]  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--foo_str"""  ,nargs="""+"""  ,default=["""Hallo""", """Bonjour""", """Hello"""]  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--foo_float"""  ,nargs="""+"""  ,default=[0.1, 0.2, 0.3]  ,type=__SCREAMING_SNAKE_CASE				)

						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  str											= parser.parse_args([]				)
						self.assertEqual(
						    __SCREAMING_SNAKE_CASE  ,Namespace(foo_int=[]  ,bar_int=[1, 2, 3]  ,foo_str=["""Hallo""", """Bonjour""", """Hello"""]  ,foo_float=[0.1, 0.2, 0.3]				)  ,)

						lowerCAmelCase__			:  Union[str, Any]											= parser.parse_args("""--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7""".split()				)
						self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo_int=[1]  ,bar_int=[2, 3]  ,foo_str=["""a""", """b""", """c"""]  ,foo_float=[0.1, 0.7]				)				)




		def 							UpperCAmelCase_     (   self				)   ->		List[str]:
						lowerCAmelCase__			:  List[str]											= argparse.ArgumentParser()
						expected.add_argument("""--foo"""  ,default=__SCREAMING_SNAKE_CASE  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--bar"""  ,default=__SCREAMING_SNAKE_CASE  ,type=__SCREAMING_SNAKE_CASE  ,help="""help message"""				)
						expected.add_argument("""--baz"""  ,default=__SCREAMING_SNAKE_CASE  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--ces"""  ,nargs="""+"""  ,default=[]  ,type=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--des"""  ,nargs="""+"""  ,default=[]  ,type=__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Optional[Any]											= [OptionalExample]
						if is_python_no_less_than_3_10:
										dataclass_types.append(__SCREAMING_SNAKE_CASE				)

						for dataclass_type in dataclass_types:
										lowerCAmelCase__			:  Tuple											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

										self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)

										lowerCAmelCase__			:  int											= parser.parse_args([]				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=__SCREAMING_SNAKE_CASE  ,bar=__SCREAMING_SNAKE_CASE  ,baz=__SCREAMING_SNAKE_CASE  ,ces=[]  ,des=[]				)				)

										lowerCAmelCase__			:  Any											= parser.parse_args("""--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3""".split()				)
										self.assertEqual(__SCREAMING_SNAKE_CASE  ,Namespace(foo=12  ,bar=3.1_4  ,baz="""42"""  ,ces=["""a""", """b""", """c"""]  ,des=[1, 2, 3]				)				)




		def 							UpperCAmelCase_     (   self				)   ->		Tuple:
						lowerCAmelCase__			:  Union[str, Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Union[str, Any]											= argparse.ArgumentParser()
						expected.add_argument("""--required_list"""  ,nargs="""+"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--required_str"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument(
						    """--required_enum"""  ,type=make_choice_type_function(["""titi""", """toto"""]				)  ,choices=["""titi""", """toto"""]  ,required=__SCREAMING_SNAKE_CASE  ,)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		Tuple:
						lowerCAmelCase__			:  Union[str, Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Any											= argparse.ArgumentParser()
						expected.add_argument("""--foo"""  ,type=__SCREAMING_SNAKE_CASE  ,required=__SCREAMING_SNAKE_CASE				)
						expected.add_argument(
						    """--required_enum"""  ,type=make_choice_type_function(["""titi""", """toto"""]				)  ,choices=["""titi""", """toto"""]  ,required=__SCREAMING_SNAKE_CASE  ,)
						expected.add_argument("""--opt"""  ,type=__SCREAMING_SNAKE_CASE  ,default=__SCREAMING_SNAKE_CASE				)
						expected.add_argument("""--baz"""  ,default="""toto"""  ,type=__SCREAMING_SNAKE_CASE  ,help="""help message"""				)
						expected.add_argument("""--foo_str"""  ,nargs="""+"""  ,default=["""Hallo""", """Bonjour""", """Hello"""]  ,type=__SCREAMING_SNAKE_CASE				)
						self.argparsersEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		List[Any]:
						lowerCAmelCase__			:  Optional[Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Tuple											= {
						    """foo""": 12,
						    """bar""": 3.1_4,
						    """baz""": """42""",
						    """flag""": True,
						}

						lowerCAmelCase__			:  Union[str, Any]											= parser.parse_dict(__SCREAMING_SNAKE_CASE				)[0]
						lowerCAmelCase__			:  Dict											= BasicExample(**__SCREAMING_SNAKE_CASE				)
						self.assertEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		Any:
						lowerCAmelCase__			:  Union[str, Any]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Any											= {
						    """foo""": 12,
						    """bar""": 3.1_4,
						    """baz""": """42""",
						    """flag""": True,
						    """extra""": 42,
						}

						self.assertRaises(__SCREAMING_SNAKE_CASE  ,parser.parse_dict  ,__SCREAMING_SNAKE_CASE  ,allow_extra_keys=__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		str:
						lowerCAmelCase__			:  List[str]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Union[str, Any]											= {
						    """foo""": 12,
						    """bar""": 3.1_4,
						    """baz""": """42""",
						    """flag""": True,
						}
						with tempfile.TemporaryDirectory() as tmp_dir:
										lowerCAmelCase__			:  Union[str, Any]											= os.path.join(__SCREAMING_SNAKE_CASE  ,"""temp_json"""				)
										os.mkdir(__SCREAMING_SNAKE_CASE				)
										with open(temp_local_path + """.json"""  ,"""w+"""				) as f:
														json.dump(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)
										lowerCAmelCase__			:  int											= parser.parse_yaml_file(Path(temp_local_path + """.json"""				)				)[0]

						lowerCAmelCase__			:  str											= BasicExample(**__SCREAMING_SNAKE_CASE				)
						self.assertEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)




		def 							UpperCAmelCase_     (   self				)   ->		int:
						lowerCAmelCase__			:  List[str]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)

						lowerCAmelCase__			:  Optional[int]											= {
						    """foo""": 12,
						    """bar""": 3.1_4,
						    """baz""": """42""",
						    """flag""": True,
						}
						with tempfile.TemporaryDirectory() as tmp_dir:
										lowerCAmelCase__			:  Dict											= os.path.join(__SCREAMING_SNAKE_CASE  ,"""temp_yaml"""				)
										os.mkdir(__SCREAMING_SNAKE_CASE				)
										with open(temp_local_path + """.yaml"""  ,"""w+"""				) as f:
														yaml.dump(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)
										lowerCAmelCase__			:  List[Any]											= parser.parse_yaml_file(Path(temp_local_path + """.yaml"""				)				)[0]
						lowerCAmelCase__			:  List[Any]											= BasicExample(**__SCREAMING_SNAKE_CASE				)
						self.assertEqual(__SCREAMING_SNAKE_CASE  ,__SCREAMING_SNAKE_CASE				)






		def 							UpperCAmelCase_     (   self				)   ->		str:
						lowerCAmelCase__			:  Optional[int]											= HfArgumentParser(__SCREAMING_SNAKE_CASE				)
						self.assertIsNotNone(__SCREAMING_SNAKE_CASE				)







'''simple docstring'''





class 	lowerCAmelCase_:
  '''simple docstring'''




  def __init__(   self  ,__UpperCAmelCase				)   ->		Tuple:
      lowerCAmelCase__			:  Union[str, Any]											= n
      lowerCAmelCase__			:  int											= [None] * self.n
      lowerCAmelCase__			:  Union[str, Any]											= 0  # index of the first element
      lowerCAmelCase__			:  Union[str, Any]											= 0
      lowerCAmelCase__			:  Union[str, Any]											= 0




  def __len__(   self				)   ->		int:
      return self.size




  def 							UpperCAmelCase_     (   self				)   ->		bool:
      return self.size == 0




  def 							UpperCAmelCase_     (   self				)   ->		Optional[Any]:
      return False if self.is_empty() else self.array[self.front]




  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase				)   ->		Union[str, Any]:
      if self.size >= self.n:
          raise Exception("""QUEUE IS FULL"""				)

      lowerCAmelCase__			:  str											= data
      lowerCAmelCase__			:  List[str]											= (self.rear + 1) % self.n
      self.size += 1
      return self






  def 							UpperCAmelCase_     (   self				)   ->		int:
      if self.size == 0:
          raise Exception("""UNDERFLOW"""				)

      lowerCAmelCase__			:  int											= self.array[self.front]
      lowerCAmelCase__			:  Optional[Any]											= None
      lowerCAmelCase__			:  int											= (self.front + 1) % self.n
      self.size -= 1
      return temp


