






'''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
A:      Optional[int]  				=				sys.version_info >= (3, 1_0)






def 	_UpperCAmelCase    (  a		:	Tuple=None						,			a		:	List[str]=None							)			->			Dict:





						"""simple docstring"""
						return field(default_factory=lambda: default						,			metadata=a							)






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      int
	SCREAMING_SNAKE_CASE_					:      float
	SCREAMING_SNAKE_CASE_					:      str
	SCREAMING_SNAKE_CASE_					:      bool






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



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






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



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






class 							__magic_name__     (	UpperCAmelCase_				):







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      Tuple        =  'titi'
	SCREAMING_SNAKE_CASE_					:      Any        =  'toto'






class 							__magic_name__     (	UpperCAmelCase_				):







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      Any        =  'titi'
	SCREAMING_SNAKE_CASE_					:      Optional[int]        =  'toto'
	SCREAMING_SNAKE_CASE_					:      List[Any]        =  4_2






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      BasicEnum        =  "toto"
	def        lowerCamelCase__		(							self       )						->  Union[str, Any]:
							lowercase_      :   str        =			BasicEnum(self.foo       )






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      MixedTypeEnum        =  "toto"
	def        lowerCamelCase__		(							self       )						->  str:
							lowercase_      :   Dict        =			MixedTypeEnum(self.foo       )






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



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






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



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






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



	SCREAMING_SNAKE_CASE_					:      List[int]        =  field()
	SCREAMING_SNAKE_CASE_					:      str        =  field()
	SCREAMING_SNAKE_CASE_					:      BasicEnum        =  field()
	def        lowerCamelCase__		(							self       )						->  Tuple:
							lowercase_      :   Dict        =			BasicEnum(self.required_enum       )






@dataclass
class 							__magic_name__     :







	"""simple docstring"""



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


if is_python_no_less_than_3_10:






						@dataclass
						class 							__magic_name__     :







							"""simple docstring"""



							SCREAMING_SNAKE_CASE_					:      bool        =  False
							SCREAMING_SNAKE_CASE_					:      bool        =  True
							SCREAMING_SNAKE_CASE_					:      bool | None        =  None






						@dataclass
						class 							__magic_name__     :







							"""simple docstring"""



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






class 							__magic_name__     (	unittest.TestCase				):







	"""simple docstring"""



	def        lowerCamelCase__		(							self  ,      _lowercase  ,      _lowercase       )						->  Optional[int]:
							self.assertEqual(len(a._actions       )  ,      len(b._actions       )       )
							for x, y in zip(a._actions  ,      b._actions       ):
													lowercase_      :   List[str]        =			{k: v for k, v in vars(_lowercase       ).items() if k != 'container'}
													lowercase_      :   List[str]        =			{k: v for k, v in vars(_lowercase       ).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'  ,      _lowercase       ) and yy.get('choices'  ,      _lowercase       ):
																			for expected_choice in yy["choices"] + xx["choices"]:
																									self.assertEqual(xx['type'](_lowercase       )  ,      yy['type'](_lowercase       )       )
																			del xx["type"], yy["type"]

													self.assertEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  List[str]:
							lowercase_      :   Optional[int]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   List[str]        =			argparse.ArgumentParser()
							expected.add_argument('--foo'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument('--bar'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument('--baz'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument('--flag'  ,      type=_lowercase  ,      default=_lowercase  ,      const=_lowercase  ,      nargs='?'       )
							self.argparsersEqual(_lowercase  ,      _lowercase       )

							lowercase_      :   List[Any]        =			['--foo', '1', '--baz', 'quux', '--bar', '0.5']
							((lowercase_)  ,      )      :   Any        =			parser.parse_args_into_dataclasses(_lowercase  ,      look_for_args_file=_lowercase       )
							self.assertFalse(example.flag       )
	def        lowerCamelCase__		(							self       )						->  List[Any]:
							lowercase_      :   Union[str, Any]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Union[str, Any]        =			argparse.ArgumentParser()
							expected.add_argument('--foo'  ,      default=42  ,      type=_lowercase       )
							expected.add_argument('--baz'  ,      default='toto'  ,      type=_lowercase  ,      help='help message'       )
							self.argparsersEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  str:
							lowercase_      :   Any        =			argparse.ArgumentParser()
							expected.add_argument('--foo'  ,      type=_lowercase  ,      default=_lowercase  ,      const=_lowercase  ,      nargs='?'       )
							expected.add_argument('--baz'  ,      type=_lowercase  ,      default=_lowercase  ,      const=_lowercase  ,      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=_lowercase  ,      dest='baz'       )
							expected.add_argument('--opt'  ,      type=_lowercase  ,      default=_lowercase       )

							lowercase_      :   Any        =			[WithDefaultBoolExample]
							if is_python_no_less_than_3_10:
													dataclass_types.append(_lowercase       )

							for dataclass_type in dataclass_types:
													lowercase_      :   List[str]        =			HfArgumentParser(_lowercase       )
													self.argparsersEqual(_lowercase  ,      _lowercase       )

													lowercase_      :   Dict        =			parser.parse_args([]       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      baz=_lowercase  ,      opt=_lowercase       )       )

													lowercase_      :   Any        =			parser.parse_args(['--foo', '--no_baz']       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      baz=_lowercase  ,      opt=_lowercase       )       )

													lowercase_      :   Optional[Any]        =			parser.parse_args(['--foo', '--baz']       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      baz=_lowercase  ,      opt=_lowercase       )       )

													lowercase_      :   Any        =			parser.parse_args(['--foo', 'True', '--baz', 'True', '--opt', 'True']       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      baz=_lowercase  ,      opt=_lowercase       )       )

													lowercase_      :   str        =			parser.parse_args(['--foo', 'False', '--baz', 'False', '--opt', 'False']       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      baz=_lowercase  ,      opt=_lowercase       )       )
	def        lowerCamelCase__		(							self       )						->  int:
							lowercase_      :   Any        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Union[str, Any]        =			argparse.ArgumentParser()
							expected.add_argument(
							    '--foo'  ,      default='toto'  ,      choices=['titi', 'toto', 42]  ,      type=make_choice_type_function(['titi', 'toto', 42]       )  ,      )
							self.argparsersEqual(_lowercase  ,      _lowercase       )

							lowercase_      :   Tuple        =			parser.parse_args([]       )
							self.assertEqual(args.foo  ,      'toto'       )
							lowercase_      :   List[str]        =			parser.parse_args_into_dataclasses([]       )[0]
							self.assertEqual(enum_ex.foo  ,      MixedTypeEnum.toto       )

							lowercase_      :   Any        =			parser.parse_args(['--foo', 'titi']       )
							self.assertEqual(args.foo  ,      'titi'       )
							lowercase_      :   List[str]        =			parser.parse_args_into_dataclasses(['--foo', 'titi']       )[0]
							self.assertEqual(enum_ex.foo  ,      MixedTypeEnum.titi       )

							lowercase_      :   Optional[Any]        =			parser.parse_args(['--foo', '42']       )
							self.assertEqual(args.foo  ,      42       )
							lowercase_      :   Any        =			parser.parse_args_into_dataclasses(['--foo', '42']       )[0]
							self.assertEqual(enum_ex.foo  ,      MixedTypeEnum.fourtytwo       )
	def        lowerCamelCase__		(							self       )						->  int:






							@dataclass
							class 							__magic_name__     :







								"""simple docstring"""



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


							lowercase_      :   Tuple        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Dict        =			argparse.ArgumentParser()
							expected.add_argument(
							    '--foo'  ,      default='toto'  ,      choices=('titi', 'toto', 42)  ,      type=make_choice_type_function(['titi', 'toto', 42]       )  ,      )
							self.argparsersEqual(_lowercase  ,      _lowercase       )

							lowercase_      :   Any        =			parser.parse_args([]       )
							self.assertEqual(args.foo  ,      'toto'       )

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

							lowercase_      :   int        =			parser.parse_args(['--foo', '42']       )
							self.assertEqual(args.foo  ,      42       )
	def        lowerCamelCase__		(							self       )						->  str:
							lowercase_      :   Union[str, Any]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Optional[int]        =			argparse.ArgumentParser()
							expected.add_argument('--foo_int'  ,      nargs='+'  ,      default=[]  ,      type=_lowercase       )
							expected.add_argument('--bar_int'  ,      nargs='+'  ,      default=[1, 2, 3]  ,      type=_lowercase       )
							expected.add_argument('--foo_str'  ,      nargs='+'  ,      default=['Hallo', 'Bonjour', 'Hello']  ,      type=_lowercase       )
							expected.add_argument('--foo_float'  ,      nargs='+'  ,      default=[0.1, 0.2, 0.3]  ,      type=_lowercase       )

							self.argparsersEqual(_lowercase  ,      _lowercase       )

							lowercase_      :   int        =			parser.parse_args([]       )
							self.assertEqual(
							    _lowercase  ,      Namespace(foo_int=[]  ,      bar_int=[1, 2, 3]  ,      foo_str=['Hallo', 'Bonjour', 'Hello']  ,      foo_float=[0.1, 0.2, 0.3]       )  ,      )

							lowercase_      :   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(_lowercase  ,      Namespace(foo_int=[1]  ,      bar_int=[2, 3]  ,      foo_str=['a', 'b', 'c']  ,      foo_float=[0.1, 0.7]       )       )
	def        lowerCamelCase__		(							self       )						->  int:
							lowercase_      :   Union[str, Any]        =			argparse.ArgumentParser()
							expected.add_argument('--foo'  ,      default=_lowercase  ,      type=_lowercase       )
							expected.add_argument('--bar'  ,      default=_lowercase  ,      type=_lowercase  ,      help='help message'       )
							expected.add_argument('--baz'  ,      default=_lowercase  ,      type=_lowercase       )
							expected.add_argument('--ces'  ,      nargs='+'  ,      default=[]  ,      type=_lowercase       )
							expected.add_argument('--des'  ,      nargs='+'  ,      default=[]  ,      type=_lowercase       )

							lowercase_      :   Any        =			[OptionalExample]
							if is_python_no_less_than_3_10:
													dataclass_types.append(_lowercase       )

							for dataclass_type in dataclass_types:
													lowercase_      :   List[Any]        =			HfArgumentParser(_lowercase       )

													self.argparsersEqual(_lowercase  ,      _lowercase       )

													lowercase_      :   Any        =			parser.parse_args([]       )
													self.assertEqual(_lowercase  ,      Namespace(foo=_lowercase  ,      bar=_lowercase  ,      baz=_lowercase  ,      ces=[]  ,      des=[]       )       )

													lowercase_      :   Optional[Any]        =			parser.parse_args('--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'.split()       )
													self.assertEqual(_lowercase  ,      Namespace(foo=12  ,      bar=3.14  ,      baz='42'  ,      ces=['a', 'b', 'c']  ,      des=[1, 2, 3]       )       )
	def        lowerCamelCase__		(							self       )						->  List[str]:
							lowercase_      :   List[str]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Dict        =			argparse.ArgumentParser()
							expected.add_argument('--required_list'  ,      nargs='+'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument('--required_str'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument(
							    '--required_enum'  ,      type=make_choice_type_function(['titi', 'toto']       )  ,      choices=['titi', 'toto']  ,      required=_lowercase  ,      )
							self.argparsersEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  Union[str, Any]:
							lowercase_      :   Tuple        =			HfArgumentParser(_lowercase       )

							lowercase_      :   List[Any]        =			argparse.ArgumentParser()
							expected.add_argument('--foo'  ,      type=_lowercase  ,      required=_lowercase       )
							expected.add_argument(
							    '--required_enum'  ,      type=make_choice_type_function(['titi', 'toto']       )  ,      choices=['titi', 'toto']  ,      required=_lowercase  ,      )
							expected.add_argument('--opt'  ,      type=_lowercase  ,      default=_lowercase       )
							expected.add_argument('--baz'  ,      default='toto'  ,      type=_lowercase  ,      help='help message'       )
							expected.add_argument('--foo_str'  ,      nargs='+'  ,      default=['Hallo', 'Bonjour', 'Hello']  ,      type=_lowercase       )
							self.argparsersEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  Union[str, Any]:
							lowercase_      :   Optional[int]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Dict        =			{
							    'foo': 12,
							    'bar': 3.14,
							    'baz': '42',
							    'flag': True,
							}

							lowercase_      :   List[str]        =			parser.parse_dict(_lowercase       )[0]
							lowercase_      :   List[Any]        =			BasicExample(**_lowercase       )
							self.assertEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  Dict:
							lowercase_      :   Dict        =			HfArgumentParser(_lowercase       )

							lowercase_      :   Optional[int]        =			{
							    'foo': 12,
							    'bar': 3.14,
							    'baz': '42',
							    'flag': True,
							    'extra': 42,
							}

							self.assertRaises(_lowercase  ,      parser.parse_dict  ,      _lowercase  ,      allow_extra_keys=_lowercase       )
	def        lowerCamelCase__		(							self       )						->  Union[str, Any]:
							lowercase_      :   Dict        =			HfArgumentParser(_lowercase       )

							lowercase_      :   List[str]        =			{
							    'foo': 12,
							    'bar': 3.14,
							    'baz': '42',
							    'flag': True,
							}
							with tempfile.TemporaryDirectory() as tmp_dir:
													lowercase_      :   Any        =			os.path.join(_lowercase  ,      'temp_json'       )
													os.mkdir(_lowercase       )
													with open(temp_local_path + '.json'  ,      'w+'       ) as f:
																			json.dump(_lowercase  ,      _lowercase       )
													lowercase_      :   int        =			parser.parse_yaml_file(Path(temp_local_path + '.json'       )       )[0]

							lowercase_      :   List[str]        =			BasicExample(**_lowercase       )
							self.assertEqual(_lowercase  ,      _lowercase       )
	def        lowerCamelCase__		(							self       )						->  Tuple:
							lowercase_      :   List[str]        =			HfArgumentParser(_lowercase       )

							lowercase_      :   List[Any]        =			{
							    'foo': 12,
							    'bar': 3.14,
							    'baz': '42',
							    'flag': True,
							}
							with tempfile.TemporaryDirectory() as tmp_dir:
													lowercase_      :   str        =			os.path.join(_lowercase  ,      'temp_yaml'       )
													os.mkdir(_lowercase       )
													with open(temp_local_path + '.yaml'  ,      'w+'       ) as f:
																			yaml.dump(_lowercase  ,      _lowercase       )
													lowercase_      :   List[Any]        =			parser.parse_yaml_file(Path(temp_local_path + '.yaml'       )       )[0]
							lowercase_      :   Optional[Any]        =			BasicExample(**_lowercase       )
							self.assertEqual(_lowercase  ,      _lowercase       )







	def        lowerCamelCase__		(							self       )						->  List[str]:
							lowercase_      :   str        =			HfArgumentParser(_lowercase       )
							self.assertIsNotNone(_lowercase       )








'''simple docstring'''

def 	_UpperCAmelCase    (  a		:	list							)			->			list:





						"""simple docstring"""
						for i in range(len(a							) - 1						,			0						,			-1							):
												lowercase_      :   Any        =			False

												for j in range(a						,			0						,			-1							):
																		if unsorted[j] < unsorted[j - 1]:
																								lowercase_  ,      lowercase_      :   Any        =			unsorted[j - 1], unsorted[j]
																								lowercase_      :   int        =			True

												for j in range(a							):
																		if unsorted[j] > unsorted[j + 1]:
																								lowercase_  ,      lowercase_      :   Union[str, Any]        =			unsorted[j + 1], unsorted[j]
																								lowercase_      :   Optional[Any]        =			True

												if not swapped:
																		break
						return unsorted


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						A:      Union[str, Any]  				=				input("Enter numbers separated by a comma:\n").strip()
						A:      Tuple  				=				[int(item) for item in user_input.split(",")]
						print(f"""{cocktail_shaker_sort(unsorted) = }""")
