





from collections.abc import Generator
from math import sin






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		Optional[Any]:






				"""simple docstring"""


				if len(lowerCamelCase__					) != 32:
								raise ValueError('''Input must be of length 32'''					)

				snake_case_		:       List[str]           =    b''''''
				for i in [3, 2, 1, 0]:
								little_endian += string_aa[8 * i : 8 * i + 8]
				return little_endian






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		Union[str, Any]:






				"""simple docstring"""


				if i < 0:
								raise ValueError('''Input must be non-negative'''					)

				snake_case_		:       Any           =    format(lowerCamelCase__					,							'''08x'''					)[-8:]
				snake_case_		:       Any           =    b''''''
				for i in [3, 2, 1, 0]:
								little_endian_hex += hex_rep[2 * i : 2 * i + 2].encode('''utf-8'''					)
				return little_endian_hex






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		Optional[Any]:






				"""simple docstring"""


				snake_case_		:       Dict           =    b''''''
				for char in message:
								bit_string += format(lowerCamelCase__					,							'''08b'''					).encode('''utf-8'''					)
				snake_case_		:       Tuple           =    format(len(lowerCamelCase__					)					,							'''064b'''					).encode('''utf-8'''					)

				# Pad bit_string to a multiple of 512 chars
				bit_string += b"1"
				while len(lowerCamelCase__					) % 512 != 448:
								bit_string += b"0"
				bit_string += to_little_endian(start_len[32:]					) + to_little_endian(start_len[:32]					)

				return bit_string






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		List[str]:






				"""simple docstring"""


				if len(lowerCamelCase__					) % 512 != 0:
								raise ValueError('''Input must have length that\'s a multiple of 512'''					)

				for pos in range(0					,							len(lowerCamelCase__					)					,							512					):
								snake_case_		:       Dict           =    bit_string[pos : pos + 512]
								snake_case_		:       Any           =    []
								for i in range(0					,							512					,							32					):
												block_words.append(int(to_little_endian(block[i : i + 32]					)					,							2					)					)
								yield block_words






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		Tuple:






				"""simple docstring"""


				if i < 0:
								raise ValueError('''Input must be non-negative'''					)

				snake_case_		:       str           =    format(lowerCamelCase__					,							'''032b'''					)
				snake_case_		:       List[str]           =    ''''''
				for c in i_str:
								new_str += "1" if c == "0" else "0"
				return int(lowerCamelCase__					,							2					)






def 	lowerCamelCase_		(							_UpperCamelCase					,							_UpperCamelCase					)						->		Optional[int]:






				"""simple docstring"""


				return (a + b) % 2**32






def 	lowerCamelCase_		(							_UpperCamelCase					,							_UpperCamelCase					)						->		int:






				"""simple docstring"""


				if i < 0:
								raise ValueError('''Input must be non-negative'''					)
				if shift < 0:
								raise ValueError('''Shift must be non-negative'''					)
				return ((i << shift) ^ (i >> (32 - shift))) % 2**32






def 	lowerCamelCase_		(							_UpperCamelCase					)						->		List[Any]:






				"""simple docstring"""


				snake_case_		:       List[str]           =    preprocess(lowerCamelCase__					)

				snake_case_		:       int           =    [int(2**32 * abs(sin(i + 1					)					)					) for i in range(64					)]

				# Starting states
				snake_case_		:       List[Any]           =    0x67452301
				snake_case_		:       Optional[int]           =    0xefcdab89
				snake_case_		:       List[Any]           =    0x98badcfe
				snake_case_		:       Optional[Any]           =    0x10325476

				snake_case_		:       Optional[int]           =    [
				    7,
				    12,
				    17,
				    22,
				    7,
				    12,
				    17,
				    22,
				    7,
				    12,
				    17,
				    22,
				    7,
				    12,
				    17,
				    22,
				    5,
				    9,
				    14,
				    20,
				    5,
				    9,
				    14,
				    20,
				    5,
				    9,
				    14,
				    20,
				    5,
				    9,
				    14,
				    20,
				    4,
				    11,
				    16,
				    23,
				    4,
				    11,
				    16,
				    23,
				    4,
				    11,
				    16,
				    23,
				    4,
				    11,
				    16,
				    23,
				    6,
				    10,
				    15,
				    21,
				    6,
				    10,
				    15,
				    21,
				    6,
				    10,
				    15,
				    21,
				    6,
				    10,
				    15,
				    21,
				]

				# Process bit string in chunks, each with 16 32-char words
				for block_words in get_block_words(lowerCamelCase__					):
								snake_case_		:       Optional[Any]           =    aa
								snake_case_		:       Union[str, Any]           =    ba
								snake_case_		:       List[Any]           =    ca
								snake_case_		:       List[Any]           =    da

								# Hash current chunk
								for i in range(64					):
												if i <= 15:
																# f = (b & c) | (not_32(b) & d)     # Alternate definition for f
																snake_case_		:       Any           =    d ^ (b & (c ^ d))
																snake_case_		:       Any           =    i
												elif i <= 31:
																# f = (d & b) | (not_32(d) & c)     # Alternate definition for f
																snake_case_		:       Any           =    c ^ (d & (b ^ c))
																snake_case_		:       Union[str, Any]           =    (5 * i + 1) % 16
												elif i <= 47:
																snake_case_		:       List[str]           =    b ^ c ^ d
																snake_case_		:       List[Any]           =    (3 * i + 5) % 16
												else:
																snake_case_		:       int           =    c ^ (b | not_aa(lowerCamelCase__					))
																snake_case_		:       Tuple           =    (7 * i) % 16
												snake_case_		:       Union[str, Any]           =    (f + a + added_consts[i] + block_words[g]) % 2**32
												snake_case_		:       Any           =    d
												snake_case_		:       Union[str, Any]           =    c
												snake_case_		:       Dict           =    b
												snake_case_		:       List[Any]           =    sum_aa(lowerCamelCase__					,							left_rotate_aa(lowerCamelCase__					,							shift_amounts[i]					)					)

								# Add hashed chunk to running total
								snake_case_		:       Tuple           =    sum_aa(lowerCamelCase__					,							lowerCamelCase__					)
								snake_case_		:       List[str]           =    sum_aa(lowerCamelCase__					,							lowerCamelCase__					)
								snake_case_		:       Optional[Any]           =    sum_aa(lowerCamelCase__					,							lowerCamelCase__					)
								snake_case_		:       str           =    sum_aa(lowerCamelCase__					,							lowerCamelCase__					)

				snake_case_		:       Optional[int]           =    reformat_hex(lowerCamelCase__					) + reformat_hex(lowerCamelCase__					) + reformat_hex(lowerCamelCase__					) + reformat_hex(lowerCamelCase__					)
				return digest


if __name__ == "__main__":
	import doctest

	doctest.testmod()




import os
import unittest

from huggingface_hub.utils import are_progress_bars_disabled

import transformers.models.bart.tokenization_bart
from transformers import logging
from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context
from transformers.utils.logging import disable_progress_bar, enable_progress_bar







class        __lowercase       (							unittest.TestCase  ):



		"""simple docstring"""

		def 					__A   ( self	)  -> Dict:







					'''simple docstring'''







					lowerCamelCase    		=  logging.get_logger()

					# the current default level is logging.WARNING
					lowerCamelCase    		=  logging.get_verbosity()

					logging.set_verbosity_error()
					self.assertEqual(logger.getEffectiveLevel()		,      logging.get_verbosity()	)

					logging.set_verbosity_warning()
					self.assertEqual(logger.getEffectiveLevel()		,      logging.get_verbosity()	)

					logging.set_verbosity_info()
					self.assertEqual(logger.getEffectiveLevel()		,      logging.get_verbosity()	)

					logging.set_verbosity_debug()
					self.assertEqual(logger.getEffectiveLevel()		,      logging.get_verbosity()	)

					# restore to the original level
					logging.set_verbosity(A	)







		def 					__A   ( self	)  -> Tuple:







					'''simple docstring'''







					lowerCamelCase    		=  logging.get_verbosity()

					lowerCamelCase    		=  logging.get_logger("""transformers.models.bart.tokenization_bart"""	)
					lowerCamelCase    		=  """Testing 1, 2, 3"""

					# should be able to log warnings (if default settings weren't overridden by `pytest --log-level-all`)
					if level_origin <= logging.WARNING:
								with CaptureLogger(A	) as cl:
											logger.warning(A	)
								self.assertEqual(cl.out		,      msg + """\n"""	)

					# this is setting the level for all of `transformers.*` loggers
					logging.set_verbosity_error()

					# should not be able to log warnings
					with CaptureLogger(A	) as cl:
								logger.warning(A	)
					self.assertEqual(cl.out		,      """"""	)

					# should be able to log warnings again
					logging.set_verbosity_warning()
					with CaptureLogger(A	) as cl:
								logger.warning(A	)
					self.assertEqual(cl.out		,      msg + """\n"""	)

					# restore to the original level
					logging.set_verbosity(A	)







		@mockenv(TRANSFORMERS_VERBOSITY="""error"""	)
		def 					__A   ( self	)  -> Union[str, Any]:







					'''simple docstring'''







					transformers.utils.logging._reset_library_root_logger()
					# this action activates the env var
					lowerCamelCase    		=  logging.get_logger("""transformers.models.bart.tokenization_bart"""	)

					lowerCamelCase    		=  os.getenv("""TRANSFORMERS_VERBOSITY"""		,      A	)
					lowerCamelCase    		=  logging.log_levels[env_level_str]

					lowerCamelCase    		=  logging.get_verbosity()
					self.assertEqual(
					    A		,      A		,      F'TRANSFORMERS_VERBOSITY={env_level_str}/{env_level}, but internal verbosity is {current_level}'		,      )

					# restore to the original level
					lowerCamelCase    		=  """"""
					transformers.utils.logging._reset_library_root_logger()







		@mockenv(TRANSFORMERS_VERBOSITY="""super-error"""	)
		def 					__A   ( self	)  -> Union[str, Any]:







					'''simple docstring'''







					transformers.utils.logging._reset_library_root_logger()
					lowerCamelCase    		=  logging.logging.getLogger()
					with CaptureLogger(A	) as cl:
								# this action activates the env var
								logging.get_logger("""transformers.models.bart.tokenization_bart"""	)
					self.assertIn("""Unknown option TRANSFORMERS_VERBOSITY=super-error"""		,      cl.out	)

					# no need to restore as nothing was changed







		def 					__A   ( self	)  -> Optional[Any]:







					'''simple docstring'''







					transformers.utils.logging._reset_library_root_logger()

					lowerCamelCase    		=  logging.get_logger("""transformers.models.bart.tokenization_bart"""	)
					lowerCamelCase    		=  """Testing 1, 2, 3"""

					with mockenv_context(TRANSFORMERS_NO_ADVISORY_WARNINGS="""1"""	):
								# nothing should be logged as env var disables this method
								with CaptureLogger(A	) as cl:
											logger.warning_advice(A	)
								self.assertEqual(cl.out		,      """"""	)

					with mockenv_context(TRANSFORMERS_NO_ADVISORY_WARNINGS=""""""	):
								# should log normally as TRANSFORMERS_NO_ADVISORY_WARNINGS is unset
								with CaptureLogger(A	) as cl:
											logger.warning_advice(A	)
								self.assertEqual(cl.out		,      msg + """\n"""	)






def 	__lowerCamelCase						(							):





			'''simple docstring'''




			disable_progress_bar()
			assert are_progress_bars_disabled()

			enable_progress_bar()
			assert not are_progress_bars_disabled()

