

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


lowerCamelCase_					  =   {'''configuration_bert_generation''': ['''BertGenerationConfig''']}

try:
    if not is_sentencepiece_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_					  =   ['''BertGenerationTokenizer''']

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase_					  =   [
        '''BertGenerationDecoder''',
        '''BertGenerationEncoder''',
        '''BertGenerationPreTrainedModel''',
        '''load_tf_weights_in_bert_generation''',
    ]


if TYPE_CHECKING:
    from .configuration_bert_generation import BertGenerationConfig

    try:
        if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_bert_generation import BertGenerationTokenizer

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_bert_generation import (
            BertGenerationDecoder,
            BertGenerationEncoder,
            BertGenerationPreTrainedModel,
            load_tf_weights_in_bert_generation,
        )

else:
    import sys

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


def   UpperCamelCase(   lowercase_				)      ->							float:





  '''simple docstring'''





  return -num if num < 0 else num



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_min() arg is an empty sequence"""				)
  snake_case_					= x[0]
  for i in x:
    if abs_val(lowercase_				) < abs_val(lowercase_				):
      snake_case_					= i
  return j



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_max() arg is an empty sequence"""				)
  snake_case_					= x[0]
  for i in x:
    if abs(lowercase_				) > abs(lowercase_				):
      snake_case_					= i
  return j



def   UpperCamelCase(   lowercase_				)      ->							int:





  '''simple docstring'''





  if len(lowercase_				) == 0:
    raise ValueError("""abs_max_sort() arg is an empty sequence"""				)
  return sorted(lowercase_     ,   key=lowercase_				)[-1]



def   UpperCamelCase(   )      ->							List[Any]:





  '''simple docstring'''





  assert abs_val(0				) == 0
  assert abs_val(34				) == 34
  assert abs_val(-100000000000				) == 100000000000

  snake_case_					= [-3, -1, 2, -11]
  assert abs_max(lowercase_				) == -11
  assert abs_max_sort(lowercase_				) == -11
  assert abs_min(lowercase_				) == -1


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    test_abs_val()
    print(abs_val(-34))  # --> 34