





'''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


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


def 	__a(SCREAMING_SNAKE_CASE_  :					List[Any]		,       SCREAMING_SNAKE_CASE_  :					int=None		,       SCREAMING_SNAKE_CASE_  :					Any=None		,       SCREAMING_SNAKE_CASE_  :					List[str]=None    ):



    '''simple docstring'''





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


def 	__a(SCREAMING_SNAKE_CASE_  :					str		,       SCREAMING_SNAKE_CASE_  :					List[Any]=[]		,       SCREAMING_SNAKE_CASE_  :					Union[str, Any]=None		,       SCREAMING_SNAKE_CASE_  :					Union[str, Any]=0    ):



    '''simple docstring'''





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


def 	__a(SCREAMING_SNAKE_CASE_  :					Dict    ):



    '''simple docstring'''





    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    return ComputeEnvironment(["LOCAL_MACHINE", "AMAZON_SAGEMAKER"][value]    )


def 	__a(SCREAMING_SNAKE_CASE_  :					Union[str, Any]    ):



    '''simple docstring'''





    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    return DistributedType(["NO", "MULTI_CPU", "MULTI_XPU", "MULTI_GPU", "MULTI_NPU", "TPU"][value]    )


def 	__a(SCREAMING_SNAKE_CASE_  :					str    ):



    '''simple docstring'''





    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    return DynamoBackend(DYNAMO_BACKENDS[value]    ).value


def 	__a(SCREAMING_SNAKE_CASE_  :					Any    ):



    '''simple docstring'''





    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    return PrecisionType(["no", "fp16", "bf16", "fp8"][value]    )


def 	__a(SCREAMING_SNAKE_CASE_  :					Optional[Any]    ):



    '''simple docstring'''





    _lowerCAmelCase				=      int(SCREAMING_SNAKE_CASE_    )
    return SageMakerDistributedType(["NO", "DATA_PARALLEL", "MODEL_PARALLEL"][value]    )


def 	__a(SCREAMING_SNAKE_CASE_  :					Dict    ):



    '''simple docstring'''





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





class    lowerCAmelCase_		(		argparse.RawDescriptionHelpFormatter		):




 def 							_snake_case   (	self			,     _lowerCAmelCase			,     _lowerCAmelCase			,     _lowerCAmelCase			,     _lowerCAmelCase		)    ->							List[Any]:
     _lowerCAmelCase				=      super()._format_usage(_lowerCAmelCase			,     _lowerCAmelCase			,     _lowerCAmelCase			,     _lowerCAmelCase		)
     _lowerCAmelCase				=      usage.replace("<command> [<args>] "			,     ""		)
     return usage









'''simple docstring'''


def 	__a(SCREAMING_SNAKE_CASE_  :					int    ):



    '''simple docstring'''





    if not isinstance(SCREAMING_SNAKE_CASE_		,       SCREAMING_SNAKE_CASE_    ):
        raise ValueError("check_bouncy() accepts only integer arguments"    )
    _lowerCAmelCase				=      str(SCREAMING_SNAKE_CASE_    )
    _lowerCAmelCase				=      "".join(sorted(SCREAMING_SNAKE_CASE_    )    )
    return sorted_str_n != str_n and sorted_str_n[::-1] != str_n


def 	__a(SCREAMING_SNAKE_CASE_  :					float = 99    ):



    '''simple docstring'''





    if not 0 < percent < 100:
        raise ValueError("solution() only accepts values from 0 to 100"    )
    _lowerCAmelCase				=      0
    _lowerCAmelCase				=      1

    while True:
        if check_bouncy(SCREAMING_SNAKE_CASE_    ):
            bouncy_num += 1
        if (bouncy_num / num) * 100 >= percent:
            return num
        num += 1


if __name__ == "__main__":
       from doctest import testmod

       testmod()
       print(f'''{solution(99)}''')


