






'''simple docstring'''







# 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


__lowerCAmelCase        =							[
    "EAGER",
    "AOT_EAGER",
    "INDUCTOR",
    "NVFUSER",
    "AOT_NVFUSER",
    "AOT_CUDAGRAPHS",
    "OFI",
    "FX2TRT",
    "ONNXRT",
    "IPEX",
]


def       __UpperCamelCase					(      lowercase_       :  int   ,       lowercase_       :  List[str]=None   ,       lowercase_       :  Union[str, Any]=None   ,       lowercase_       :  List[Any]=None   ):
       """simple docstring"""




       a_						     =			True
       while ask_again:
              a_						     =			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       __UpperCamelCase					(      lowercase_       :  Any   ,       lowercase_       :  Any=[]   ,       lowercase_       :  List[str]=None   ,       lowercase_       :  Union[str, Any]=0   ):
       """simple docstring"""




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


def       __UpperCamelCase					(      lowercase_       :  int   ):
       """simple docstring"""




       a_						     =			int(lowercase_   )
       return ComputeEnvironment(['LOCAL_MACHINE', 'AMAZON_SAGEMAKER'][value]   )


def       __UpperCamelCase					(      lowercase_       :  List[Any]   ):
       """simple docstring"""




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


def       __UpperCamelCase					(      lowercase_       :  str   ):
       """simple docstring"""




       a_						     =			int(lowercase_   )
       return DynamoBackend(DYNAMO_BACKENDS[value]   ).value


def       __UpperCamelCase					(      lowercase_       :  Union[str, Any]   ):
       """simple docstring"""




       a_						     =			int(lowercase_   )
       return PrecisionType(['no', 'fp16', 'bf16', 'fp8'][value]   )


def       __UpperCamelCase					(      lowercase_       :  List[Any]   ):
       """simple docstring"""




       a_						     =			int(lowercase_   )
       return SageMakerDistributedType(['NO', 'DATA_PARALLEL', 'MODEL_PARALLEL'][value]   )


def       __UpperCamelCase					(      lowercase_       :  Union[str, Any]   ):
       """simple docstring"""




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




class   __SCREAMING_SNAKE_CASE       (argparse.RawDescriptionHelpFormatter       ):


  """simple docstring"""


  def    _a       (			self   ,	UpperCamelCase__   ,	UpperCamelCase__   ,	UpperCamelCase__   ,	UpperCamelCase__	):






         """simple docstring"""


         a_						     =			super()._format_usage(UpperCamelCase__   ,	UpperCamelCase__   ,	UpperCamelCase__   ,	UpperCamelCase__	)
         a_						     =			usage.replace('<command> [<args>] '   ,	''	)
         return usage












'''simple docstring'''







import cmath
import math


def       __UpperCamelCase					(      lowercase_       :  float   ,       lowercase_       :  float   ,       lowercase_       :  float   ,       lowercase_       :  float   ):
       """simple docstring"""




       a_						     =			math.radians(lowercase_   )
       a_						     =			math.radians(lowercase_   )

       # Convert voltage and current to rectangular form
       a_						     =			cmath.rect(lowercase_   ,       lowercase_   )
       a_						     =			cmath.rect(lowercase_   ,       lowercase_   )

       # Calculate apparent power
       return voltage_rect * current_rect


if __name__ == "__main__":
  import doctest

  doctest.testmod()




