



# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


__snake_case       :	Optional[Any]            =[
    'EAGER',
    'AOT_EAGER',
    'INDUCTOR',
    'NVFUSER',
    'AOT_NVFUSER',
    'AOT_CUDAGRAPHS',
    'OFI',
    'FX2TRT',
    'ONNXRT',
    'IPEX',
]






def 			lowerCAmelCase__	(					lowerCamelCase_	:	int ,lowerCamelCase_	:	List[Any]=None ,lowerCamelCase_	:	Dict=None ,lowerCamelCase_	:	Dict=None):





				'''simple docstring'''

				lowerCAmelCase__  :       List[str]				=  True
				while ask_again:
								lowerCAmelCase__  :       List[str]				=  input(lowerCamelCase_)
								try:
												if default is not None and len(lowerCamelCase_) == 0:
																return default
												return convert_value(lowerCamelCase_) if convert_value is not None else result
								except Exception:
												if error_message is not None:
																print(lowerCamelCase_)






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Tuple ,lowerCamelCase_	:	Any=[] ,lowerCamelCase_	:	Dict=None ,lowerCamelCase_	:	List[Any]=0):





				'''simple docstring'''

				lowerCAmelCase__  :       Union[str, Any]				=  BulletMenu(lowerCamelCase_ ,lowerCamelCase_)
				lowerCAmelCase__  :       Union[str, Any]				=  menu.run(default_choice=lowerCamelCase_)
				return convert_value(lowerCamelCase_) if convert_value is not None else result






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Dict):





				'''simple docstring'''

				lowerCAmelCase__  :       List[str]				=  int(lowerCamelCase_)
				return ComputeEnvironment(['''LOCAL_MACHINE''', '''AMAZON_SAGEMAKER'''][value])






def 			lowerCAmelCase__	(					lowerCamelCase_	:	str):





				'''simple docstring'''

				lowerCAmelCase__  :       Optional[Any]				=  int(lowerCamelCase_)
				return DistributedType(['''NO''', '''MULTI_CPU''', '''MULTI_XPU''', '''MULTI_GPU''', '''MULTI_NPU''', '''TPU'''][value])






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Union[str, Any]):





				'''simple docstring'''

				lowerCAmelCase__  :       Optional[int]				=  int(lowerCamelCase_)
				return DynamoBackend(DYNAMO_BACKENDS[value]).value






def 			lowerCAmelCase__	(					lowerCamelCase_	:	str):





				'''simple docstring'''

				lowerCAmelCase__  :       str				=  int(lowerCamelCase_)
				return PrecisionType(['''no''', '''fp16''', '''bf16''', '''fp8'''][value])






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Any):





				'''simple docstring'''

				lowerCAmelCase__  :       int				=  int(lowerCamelCase_)
				return SageMakerDistributedType(['''NO''', '''DATA_PARALLEL''', '''MODEL_PARALLEL'''][value])






def 			lowerCAmelCase__	(					lowerCamelCase_	:	Optional[int]):





				'''simple docstring'''

				return {"yes": True, "no": False}[value.lower()]



class  lowerCamelCase__    (							argparse.RawDescriptionHelpFormatter):




		'''simple docstring'''



		def 	lowerCAmelCase__   (self	,__lowerCamelCase	,__lowerCamelCase	,__lowerCamelCase	,__lowerCamelCase				)  ->    List[Any]:

						"""simple docstring"""






						lowerCAmelCase__  :       str				=  super()._format_usage(__lowerCamelCase	,__lowerCamelCase	,__lowerCamelCase	,__lowerCamelCase				)
						lowerCAmelCase__  :       Tuple				=  usage.replace('''<command> [<args>] '''	,''''''				)
						return usage






from __future__ import annotations

from collections.abc import Iterable, Iterator
from dataclasses import dataclass

__snake_case       :	Optional[int]            =(3, 9, -1_1, 0, 7, 5, 1, -1)
__snake_case       :	str            =(4, 6, 2, 0, 8, 1_0, 3, -2)



@dataclass
class  lowerCamelCase__    :




		'''simple docstring'''



		snake_case_			=42
		snake_case_			=42



class  lowerCamelCase__    :




		'''simple docstring'''



		def __init__(self	,__lowerCamelCase				)  ->    None:

						"""simple docstring"""






						lowerCAmelCase__  :       Node | None				=  None
						for i in sorted(__lowerCamelCase	,reverse=__lowerCamelCase				):
										lowerCAmelCase__  :       Dict				=  Node(__lowerCamelCase	,self.head				)



		def __iter__(self				)  ->    Iterator[int]:

						"""simple docstring"""






						lowerCAmelCase__  :       Optional[Any]				=  self.head
						while node:
										yield node.data
										lowerCAmelCase__  :       Dict				=  node.next_node



		def __len__(self				)  ->    int:

						"""simple docstring"""






						return sum(1 for _ in self				)



		def __str__(self				)  ->    str:

						"""simple docstring"""






						return " -> ".join([str(__lowerCamelCase				) for node in self]				)






def 			lowerCAmelCase__	(					lowerCamelCase_	:	SortedLinkedList ,lowerCamelCase_	:	SortedLinkedList):





				'''simple docstring'''

				return SortedLinkedList(list(lowerCamelCase_) + list(lowerCamelCase_))


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							__snake_case       :	Any            =SortedLinkedList
							print(merge_lists(SSL(test_data_odd), SSL(test_data_even)))

