
# 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


_UpperCAmelCase      :				Tuple          = [
    "EAGER",
    "AOT_EAGER",
    "INDUCTOR",
    "NVFUSER",
    "AOT_NVFUSER",
    "AOT_CUDAGRAPHS",
    "OFI",
    "FX2TRT",
    "ONNXRT",
    "IPEX",
]


def    A (      lowercase					, lowercase=None					, lowercase=None					, lowercase=None				)     ->						str:
		'''simple docstring'''

		UpperCamelCase						=  True
		while ask_again:
				UpperCamelCase						=  input(lowercase				)
				try:
						if default is not None and len(lowercase				) == 0:
								return default
						return convert_value(lowercase				) if convert_value is not None else result
				except Exception:
						if error_message is not None:
								print(lowercase				)


def    A (      lowercase					, lowercase=[]					, lowercase=None					, lowercase=0				)     ->						Any:
		'''simple docstring'''

		UpperCamelCase						=  BulletMenu(lowercase					, lowercase				)
		UpperCamelCase						=  menu.run(default_choice=lowercase				)
		return convert_value(lowercase				) if convert_value is not None else result


def    A (      lowercase				)     ->						Union[str, Any]:
		'''simple docstring'''

		UpperCamelCase						=  int(lowercase				)
		return ComputeEnvironment(['LOCAL_MACHINE', 'AMAZON_SAGEMAKER'][value]				)


def    A (      lowercase				)     ->						Union[str, Any]:
		'''simple docstring'''

		UpperCamelCase						=  int(lowercase				)
		return DistributedType(['NO', 'MULTI_CPU', 'MULTI_XPU', 'MULTI_GPU', 'MULTI_NPU', 'TPU'][value]				)


def    A (      lowercase				)     ->						Tuple:
		'''simple docstring'''

		UpperCamelCase						=  int(lowercase				)
		return DynamoBackend(DYNAMO_BACKENDS[value]				).value


def    A (      lowercase				)     ->						Union[str, Any]:
		'''simple docstring'''

		UpperCamelCase						=  int(lowercase				)
		return PrecisionType(['no', 'fp16', 'bf16', 'fp8'][value]				)


def    A (      lowercase				)     ->						str:
		'''simple docstring'''

		UpperCamelCase						=  int(lowercase				)
		return SageMakerDistributedType(['NO', 'DATA_PARALLEL', 'MODEL_PARALLEL'][value]				)


def    A (      lowercase				)     ->						Optional[Any]:
		'''simple docstring'''

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


class        lowercase      (	argparse.RawDescriptionHelpFormatter     ):



		def __UpperCamelCase				(				self       ,   A_       ,   A_       ,   A_       ,   A_ )						->      str:
				"""simple docstring"""
				UpperCamelCase						=  super()._format_usage(A_       ,   A_       ,   A_       ,   A_ )
				UpperCamelCase						=  usage.replace('<command> [<args>] '       ,   '' )
				return usage


import re


def    A (      lowercase				)     ->						str:
		'''simple docstring'''

		if len(re.findall('[ATCG]'					, lowercase				)				) != len(lowercase				):
				raise ValueError('Invalid Strand'				)

		return dna.translate(dna.maketrans('ATCG'					, 'TAGC'				)				)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
