

UpperCAmelCase__			:  Union[str, Any]					     =     {hex(i)[2:]: i for i in range(16)}  # Use [:2] to strip off the leading '0x'






def        __lowercase   (  _A      )  ->    int:
      SCREAMING_SNAKE_CASE			:   Optional[Any]	  = hex_string.strip().lower()
      if not hex_string:
            raise ValueError("""Empty string was passed to the function"""      )
      SCREAMING_SNAKE_CASE			:   str	  = hex_string[0] == """-"""
      if is_negative:
            SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = hex_string[1:]
      if not all(char in hex_table for char in hex_string      ):
            raise ValueError("""Non-hexadecimal value was passed to the function"""      )
      SCREAMING_SNAKE_CASE			:   str	  = 0
      for char in hex_string:
            SCREAMING_SNAKE_CASE			:   str	  = 16 * decimal_number + hex_table[char]
      return -decimal_number if is_negative else decimal_number


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

  testmod()







from typing import TYPE_CHECKING

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


UpperCAmelCase__			:  Dict					     =     {"""configuration_hubert""": ["""HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """HubertConfig"""]}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__			:  Union[str, Any]					     =     [
      """HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """HubertForCTC""",
      """HubertForSequenceClassification""",
      """HubertModel""",
      """HubertPreTrainedModel""",
  ]


try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__			:  List[Any]					     =     [
      """TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFHubertForCTC""",
      """TFHubertModel""",
      """TFHubertPreTrainedModel""",
  ]

if TYPE_CHECKING:
  from .configuration_hubert import HUBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, HubertConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_hubert import (
        HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        HubertForCTC,
        HubertForSequenceClassification,
        HubertModel,
        HubertPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_hubert import (
        TF_HUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFHubertForCTC,
        TFHubertModel,
        TFHubertPreTrainedModel,
    )


else:
  import sys

  UpperCAmelCase__			:  str					     =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




