
"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


_a														=		{
    """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig"""],
    """processing_trocr""": ["""TrOCRProcessor"""],
}


try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				_a														=		[
				    """TROCR_PRETRAINED_MODEL_ARCHIVE_LIST""",
				    """TrOCRForCausalLM""",
				    """TrOCRPreTrainedModel""",
				]


if TYPE_CHECKING:
				from .configuration_trocr import TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP, TrOCRConfig
				from .processing_trocr import TrOCRProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_trocr import TROCR_PRETRAINED_MODEL_ARCHIVE_LIST, TrOCRForCausalLM, TrOCRPreTrainedModel

else:
				import sys

				_a														=		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)








"""simple docstring"""





def 				lowerCamelCase__		(      __snake_case,					__snake_case     )							->		str:


					"""simple docstring"""





					if number < 0 or shift_amount < 0:
										raise ValueError('''both inputs must be positive integers'''     )

					_UpperCamelCase										=  str(bin(__snake_case     )     )
					binary_number += "0" * shift_amount
					return binary_number



def 				lowerCamelCase__		(      __snake_case,					__snake_case     )							->		str:


					"""simple docstring"""





					if number < 0 or shift_amount < 0:
										raise ValueError('''both inputs must be positive integers'''     )

					_UpperCamelCase										=  str(bin(__snake_case     )     )[2:]
					if shift_amount >= len(__snake_case     ):
										return "0b0"
					_UpperCamelCase										=  binary_number[: len(__snake_case     ) - shift_amount]
					return "0b" + shifted_binary_number



def 				lowerCamelCase__		(      __snake_case,					__snake_case     )							->		str:


					"""simple docstring"""





					if number >= 0:  # Get binary representation of positive number
										_UpperCamelCase										=  '''0''' + str(bin(__snake_case     )     ).strip('''-'''     )[2:]
					else:  # Get binary (2's complement) representation of negative number
										_UpperCamelCase										=  len(bin(__snake_case     )[3:]     )  # Find 2's complement of number
										_UpperCamelCase										=  bin(abs(__snake_case     ) - (1 << binary_number_length)     )[3:]
										_UpperCamelCase										=  (
										    '''1''' + '''0''' * (binary_number_length - len(__snake_case     )) + binary_number
										)

					if shift_amount >= len(__snake_case     ):
										return "0b" + binary_number[0] * len(__snake_case     )
					return (
					    "0b"
					    + binary_number[0] * shift_amount
					    + binary_number[: len(__snake_case     ) - shift_amount]
					)


if __name__ == "__main__":
				import doctest

				doctest.testmod()






