


import argparse
import hashlib  # hashlib is only used inside the Test class
import struct







class        a					:





     def __init__(    self					:				Union[str, Any]    ,	SCREAMING_SNAKE_CASE_					:				List[Any]							):
        __lowerCamelCase:				List[str]     =	data
        __lowerCamelCase:				Dict     =	[0x6_7_4_5_2_3_0_1, 0xE_F_C_D_A_B_8_9, 0x9_8_B_A_D_C_F_E, 0x1_0_3_2_5_4_7_6, 0xC_3_D_2_E_1_F_0]





     @staticmethod
     def  SCREAMING_SNAKE_CASE__       (    SCREAMING_SNAKE_CASE_					:				str    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]							):
        return ((n << b) | (n >> (32 - b))) & 0xF_F_F_F_F_F_F_F





     def  SCREAMING_SNAKE_CASE__       (    self					:				Any							):
        __lowerCamelCase:				List[Any]     =	B"""\x80""" + B"""\x00""" * (63 - (len(self.data							) + 8) % 64)
        __lowerCamelCase:				str     =	self.data + padding + struct.pack(""">Q"""    ,	8 * len(self.data							)							)
        return padded_data





     def  SCREAMING_SNAKE_CASE__       (    self					:				Dict							):
        return [
            self.padded_data[i : i + 64] for i in range(0    ,	len(self.padded_data							)    ,	64							)
        ]





     def  SCREAMING_SNAKE_CASE__       (    self					:				str    ,	SCREAMING_SNAKE_CASE_					:				str							):
        __lowerCamelCase:				Dict     =	list(struct.unpack(""">16L"""    ,	UpperCAmelCase_							)							) + [0] * 64
        for i in range(16    ,	80							):
           __lowerCamelCase:				Dict     =	self.rotate((w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16])    ,	1							)
        return w







     def  SCREAMING_SNAKE_CASE__       (    self					:				Tuple							):
        __lowerCamelCase:				Tuple     =	self.padding()
        __lowerCamelCase:				Optional[int]     =	self.split_blocks()
        for block in self.blocks:
           __lowerCamelCase:				int     =	self.expand_block(UpperCAmelCase_							)
           __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase:				Union[str, Any]     =	self.h
           for i in range(0    ,	80							):
              if 0 <= i < 20:
                 __lowerCamelCase:				int     =	(b & c) | ((~b) & d)
                 __lowerCamelCase:				Optional[int]     =	0x5_A_8_2_7_9_9_9
              elif 20 <= i < 40:
                 __lowerCamelCase:				Optional[Any]     =	b ^ c ^ d
                 __lowerCamelCase:				Union[str, Any]     =	0x6_E_D_9_E_B_A_1
              elif 40 <= i < 60:
                 __lowerCamelCase:				Any     =	(b & c) | (b & d) | (c & d)
                 __lowerCamelCase:				int     =	0x8_F_1_B_B_C_D_C
              elif 60 <= i < 80:
                 __lowerCamelCase:				Optional[Any]     =	b ^ c ^ d
                 __lowerCamelCase:				Tuple     =	0xC_A_6_2_C_1_D_6
              __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase   ,     __lowerCamelCase:				List[str]     =	(
                  self.rotate(UpperCAmelCase_    ,	5							) + f + e + k + expanded_block[i] & 0xF_F_F_F_F_F_F_F,
                  a,
                  self.rotate(UpperCAmelCase_    ,	30							),
                  c,
                  d,
              )
           __lowerCamelCase:				Union[str, Any]     =	(
               self.h[0] + a & 0xF_F_F_F_F_F_F_F,
               self.h[1] + b & 0xF_F_F_F_F_F_F_F,
               self.h[2] + c & 0xF_F_F_F_F_F_F_F,
               self.h[3] + d & 0xF_F_F_F_F_F_F_F,
               self.h[4] + e & 0xF_F_F_F_F_F_F_F,
           )
        return ("{:08x}" * 5).format(*self.h							)



def     __lowerCAmelCase						(							)       ->							Optional[Any]:
   __lowerCamelCase:				List[Any]     =	B"""Test String"""
   assert SHAaHash(_snake_case ).final_hash() == hashlib.shaa(_snake_case ).hexdigest()  # noqa: S324



def     __lowerCAmelCase						(							)       ->							List[Any]:
   __lowerCamelCase:				int     =	argparse.ArgumentParser(description="""Process some strings or files""" )
   parser.add_argument(
       """--string"""						,      dest="""input_string"""						,      default="""Hello World!! Welcome to Cryptography"""						,      help="""Hash the string"""						,      )
   parser.add_argument("""--file"""						,      dest="""input_file"""						,      help="""Hash contents of a file""" )
   __lowerCamelCase:				int     =	parser.parse_args()
   __lowerCamelCase:				Dict     =	args.input_string
   # In any case hash input should be a bytestring
   if args.input_file:
      with open(args.input_file						,      """rb""" ) as f:
         __lowerCamelCase:				int     =	f.read()
   else:
      __lowerCamelCase:				Optional[Any]     =	bytes(_snake_case						,      """utf-8""" )
   print(SHAaHash(_snake_case ).final_hash() )


if __name__ == "__main__":
   main()
   import doctest

   doctest.testmod()






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin



class        a					(			_UpperCAmelCase   ):
     UpperCAmelCase__ :  Dict						      =	"Speech2TextFeatureExtractor"
     UpperCAmelCase__ :  str						      =	"Speech2TextTokenizer"





     def __init__(    self					:				Optional[Any]    ,	SCREAMING_SNAKE_CASE_					:				List[str]    ,	SCREAMING_SNAKE_CASE_					:				Optional[int]							):
        super().__init__(SCREAMING_SNAKE_CASE_    ,	SCREAMING_SNAKE_CASE_							)
        __lowerCamelCase:				Any     =	self.feature_extractor
        __lowerCamelCase:				List[Any]     =	False





     def __call__(    self					:				List[str]    ,	*SCREAMING_SNAKE_CASE_					:				Union[str, Any]    ,	**SCREAMING_SNAKE_CASE_					:				List[Any]							):
        # For backward compatibility
        if self._in_target_context_manager:
           return self.current_processor(*SCREAMING_SNAKE_CASE_    ,	**SCREAMING_SNAKE_CASE_							)

        if "raw_speech" in kwargs:
           warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""							)
           __lowerCamelCase:				Dict     =	kwargs.pop("""raw_speech"""							)
        else:
           __lowerCamelCase:				int     =	kwargs.pop("""audio"""    ,	SCREAMING_SNAKE_CASE_							)
        __lowerCamelCase:				Dict     =	kwargs.pop("""sampling_rate"""    ,	SCREAMING_SNAKE_CASE_							)
        __lowerCamelCase:				int     =	kwargs.pop("""text"""    ,	SCREAMING_SNAKE_CASE_							)
        if len(SCREAMING_SNAKE_CASE_							) > 0:
           __lowerCamelCase:				Dict     =	args[0]
           __lowerCamelCase:				Optional[Any]     =	args[1:]

        if audio is None and text is None:
           raise ValueError("""You need to specify either an `audio` or `text` input to process."""							)

        if audio is not None:
           __lowerCamelCase:				List[str]     =	self.feature_extractor(SCREAMING_SNAKE_CASE_    ,	*SCREAMING_SNAKE_CASE_    ,	sampling_rate=SCREAMING_SNAKE_CASE_    ,	**SCREAMING_SNAKE_CASE_							)
        if text is not None:
           __lowerCamelCase:				Any     =	self.tokenizer(SCREAMING_SNAKE_CASE_    ,	**SCREAMING_SNAKE_CASE_							)

        if text is None:
           return inputs
        elif audio is None:
           return encodings
        else:
           __lowerCamelCase:				List[Any]     =	encodings["""input_ids"""]
           return inputs





     def  SCREAMING_SNAKE_CASE__       (    self					:				List[str]    ,	*SCREAMING_SNAKE_CASE_					:				Optional[Any]    ,	**SCREAMING_SNAKE_CASE_					:				str							):
        return self.tokenizer.batch_decode(*SCREAMING_SNAKE_CASE_    ,	**SCREAMING_SNAKE_CASE_							)





     def  SCREAMING_SNAKE_CASE__       (    self					:				Tuple    ,	*SCREAMING_SNAKE_CASE_					:				Any    ,	**SCREAMING_SNAKE_CASE_					:				List[Any]							):
        return self.tokenizer.decode(*SCREAMING_SNAKE_CASE_    ,	**SCREAMING_SNAKE_CASE_							)







     @contextmanager
     def  SCREAMING_SNAKE_CASE__       (    self					:				Any							):
        warnings.warn(
            """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
            """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
            """your audio inputs, or in a separate call."""							)
        __lowerCamelCase:				Any     =	True
        __lowerCamelCase:				Any     =	self.tokenizer
        yield
        __lowerCamelCase:				Any     =	self.feature_extractor
        __lowerCamelCase:				Optional[Any]     =	False


