



"""simple docstring"""







UpperCAmelCase:  Optional[Any]			     =				{
    """0000""": """0""",
    """0001""": """1""",
    """0010""": """2""",
    """0011""": """3""",
    """0100""": """4""",
    """0101""": """5""",
    """0110""": """6""",
    """0111""": """7""",
    """1000""": """8""",
    """1001""": """9""",
    """1010""": """a""",
    """1011""": """b""",
    """1100""": """c""",
    """1101""": """d""",
    """1110""": """e""",
    """1111""": """f""",
}


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase      ):
		_lowercase				: Any     =   str(__UpperCAmelCase      ).strip()

		# Exceptions
		if not binary_str:
				raise ValueError("""Empty string was passed to the function"""      )
		_lowercase				: Tuple     =   binary_str[0] == """-"""
		_lowercase				: List[str]     =   binary_str[1:] if is_negative else binary_str
		if not all(char in """01""" for char in binary_str      ):
				raise ValueError("""Non-binary value was passed to the function"""      )

		_lowercase				: Any     =   (
		    """0""" * (4 * (divmod(len(__UpperCAmelCase      )   ,				4      )[0] + 1) - len(__UpperCAmelCase      )) + binary_str
		)

		_lowercase				: Union[str, Any]     =   []
		for x in range(0   ,				len(__UpperCAmelCase      )   ,				4      ):
				hexadecimal.append(BITS_TO_HEX[binary_str[x : x + 4]]      )
		_lowercase				: str     =   """0x""" + """""".join(__UpperCAmelCase      )

		return "-" + hexadecimal_str if is_negative else hexadecimal_str


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

		testmod()







# Copyright 2023 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.
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
    is_vision_available,
)


__lowerCamelCase   	=  {
    '''configuration_tvlt''': ['''TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TvltConfig'''],
    '''feature_extraction_tvlt''': ['''TvltFeatureExtractor'''],
    '''processing_tvlt''': ['''TvltProcessor'''],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCamelCase   	=  [
           '''TVLT_PRETRAINED_MODEL_ARCHIVE_LIST''',
           '''TvltModel''',
           '''TvltForPreTraining''',
           '''TvltForAudioVisualClassification''',
           '''TvltPreTrainedModel''',
       ]

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCamelCase   	=  ['''TvltImageProcessor''']


if TYPE_CHECKING:
       from .configuration_tvlt import TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP, TvltConfig
       from .processing_tvlt import TvltProcessor
       from .feature_extraction_tvlt import TvltFeatureExtractor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tvlt import (
                  TVLT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TvltForAudioVisualClassification,
                  TvltForPreTraining,
                  TvltModel,
                  TvltPreTrainedModel,
              )

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .image_processing_tvlt import TvltImageProcessor


else:
       import sys

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



