"""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  =				sys.version_info >= (3, 10)


def    lowercase_   (   _lowerCamelCase:	Tuple=None						,   _lowerCamelCase:	List[str]=None      ) ->      Dict:



							'''simple docstring'''

							return field(default_factory=lambda: default						,   metadata=_lowerCamelCase      )
@dataclass
class  _snake_case     :
						snake_case__			  =			42
						snake_case__			  =			42
						snake_case__			  =			42
						snake_case__			  =			42

@dataclass
class  _snake_case     :
						snake_case__			  =			42
						snake_case__			  =			field(default="toto"				, metadata={"help": "help message"}		)

@dataclass
class  _snake_case     :
						snake_case__			  =			False
						snake_case__			  =			True
						snake_case__			  =			None

class  _snake_case     (					UpperCAmelCase_		):
						snake_case__			  =			'titi'
						snake_case__			  =			'toto'

class  _snake_case     (					UpperCAmelCase_		):
						snake_case__			  =			'titi'
						snake_case__			  =			'toto'
						snake_case__			  =			42

@dataclass
class  _snake_case     :
						snake_case__			  =			"toto"






						def       lowerCamelCase__     (       self      :			int    ):
													__lowerCamelCase					:		str		   =     BasicEnum(self.foo    )

@dataclass
class  _snake_case     :
						snake_case__			  =			"toto"






						def       lowerCamelCase__     (       self      :			str    ):
													__lowerCamelCase					:		Dict		   =     MixedTypeEnum(self.foo    )

@dataclass
class  _snake_case     :
						snake_case__			  =			None
						snake_case__			  =			field(default=UpperCAmelCase_				, metadata={"help": "help message"}		)
						snake_case__			  =			None
						snake_case__			  =			list_field(default=[]		)
						snake_case__			  =			list_field(default=[]		)

@dataclass
class  _snake_case     :
						snake_case__			  =			list_field(default=[]		)
						snake_case__			  =			list_field(default=[1, 2, 3]		)
						snake_case__			  =			list_field(default=["Hallo", "Bonjour", "Hello"]		)
						snake_case__			  =			list_field(default=[0.1, 0.2, 0.3]		)

@dataclass
class  _snake_case     :
						snake_case__			  =			field()
						snake_case__			  =			field()
						snake_case__			  =			field()






						def       lowerCamelCase__     (       self      :			str    ):
													__lowerCamelCase					:		Dict		   =     BasicEnum(self.required_enum    )

@dataclass
class  _snake_case     :
						snake_case__			  =			42
						snake_case__			  =			field()
						snake_case__			  =			None
						snake_case__			  =			field(default="toto"				, metadata={"help": "help message"}		)
						snake_case__			  =			list_field(default=["Hallo", "Bonjour", "Hello"]		)


if is_python_no_less_than_3_10:
				@dataclass
				class  _snake_case     :
										snake_case__			  =			False
										snake_case__			  =			True
										snake_case__			  =			None

				@dataclass
				class  _snake_case     :
										snake_case__			  =			None
										snake_case__			  =			field(default=UpperCAmelCase_				, metadata={"help": "help message"}		)
										snake_case__			  =			None
										snake_case__			  =			list_field(default=[]		)
										snake_case__			  =			list_field(default=[]		)







class  _snake_case     (					unittest.TestCase		):






						def       lowerCamelCase__     (       self      :			List[str]							,					UpperCAmelCase      :			int							,					UpperCAmelCase      :			List[str]    ):
													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(_lowercase    ).items() if k != 'container'}
																				__lowerCamelCase					:		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      :			Dict    ):
													__lowerCamelCase					:		Optional[int]		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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    )

													__lowerCamelCase					:		List[Any]		   =     ['--foo', '1', '--baz', 'quux', '--bar', '0.5']
													(__lowerCamelCase      )					:		Any		   =     parser.parse_args_into_dataclasses(_lowercase							,					look_for_args_file=_lowercase    )
													self.assertFalse(example.flag    )






						def       lowerCamelCase__     (       self      :			int    ):
													__lowerCamelCase					:		Union[str, Any]		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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      :			Union[str, Any]    ):
													__lowerCamelCase					:		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    )

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

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

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

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

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

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

																				__lowerCamelCase					:		str		   =     parser.parse_args(["--foo", "False", "--baz", "False", "--opt", "False"]    )
																				self.assertEqual(_lowercase							,					Namespace(foo=_lowercase							,					baz=_lowercase							,					opt=_lowercase    )    )






						def       lowerCamelCase__     (       self      :			Optional[int]    ):
													__lowerCamelCase					:		Any		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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    )

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

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

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






						def       lowerCamelCase__     (       self      :			Any    ):
													@dataclass
													class  _snake_case     :
																			snake_case__			  =			"toto"

													__lowerCamelCase					:		Tuple		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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    )

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

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

													__lowerCamelCase					:		int		   =     parser.parse_args(["--foo", "42"]    )
													self.assertEqual(args.foo							,					42    )






						def       lowerCamelCase__     (       self      :			Dict    ):
													__lowerCamelCase					:		Union[str, Any]		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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    )

													__lowerCamelCase					:		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]    )							,					)

													__lowerCamelCase					:		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      :			List[Any]    ):
													__lowerCamelCase					:		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    )

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

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

																				self.argparsersEqual(_lowercase							,					_lowercase    )

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

																				__lowerCamelCase					:		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.1_4							,					baz="42"							,					ces=["a", "b", "c"]							,					des=[1, 2, 3]    )    )






						def       lowerCamelCase__     (       self      :			Dict    ):
													__lowerCamelCase					:		List[str]		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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      :			Tuple    ):
													__lowerCamelCase					:		Tuple		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		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      :			Optional[Any]    ):
													__lowerCamelCase					:		Optional[int]		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		Dict		   =     {
													    'foo': 12,
													    'bar': 3.1_4,
													    'baz': '42',
													    'flag': True,
													}

													__lowerCamelCase					:		List[str]		   =     parser.parse_dict(_lowercase    )[0]
													__lowerCamelCase					:		List[Any]		   =     BasicExample(**_lowercase    )
													self.assertEqual(_lowercase							,					_lowercase    )






						def       lowerCamelCase__     (       self      :			Tuple    ):
													__lowerCamelCase					:		Dict		   =     HfArgumentParser(_lowercase    )

													__lowerCamelCase					:		Optional[int]		   =     {
													    'foo': 12,
													    'bar': 3.1_4,
													    'baz': '42',
													    'flag': True,
													    'extra': 42,
													}

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






						def       lowerCamelCase__     (       self      :			Optional[int]    ):
													__lowerCamelCase					:		Dict		   =     HfArgumentParser(_lowercase    )

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

													__lowerCamelCase					:		List[str]		   =     BasicExample(**_lowercase    )
													self.assertEqual(_lowercase							,					_lowercase    )






						def       lowerCamelCase__     (       self      :			Any    ):
													__lowerCamelCase					:		List[str]		   =     HfArgumentParser(_lowercase    )

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







						def       lowerCamelCase__     (       self      :			str    ):
													__lowerCamelCase					:		str		   =     HfArgumentParser(_lowercase    )
													self.assertIsNotNone(_lowercase    )
"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import _LazyModule


__A  =				{'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']}


if TYPE_CHECKING:
				from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
				import sys

				__A  =				_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)