



"""simple docstring"""


from ...processing_utils import ProcessorMixin







class 				A_      (					SCREAMING_SNAKE_CASE_    ):



						"""simple docstring"""
						__UpperCamelCase		    =							"""WhisperFeatureExtractor"""
						__UpperCamelCase		    =							"""WhisperTokenizer"""






						def __init__( self			:List[Any]       ,  lowercase_			:Optional[Any]       ,  lowercase_			:List[Any] )    ->      str:
												super().__init__(lowercase_       ,  lowercase_ )
												UpperCAmelCase					=			self.feature_extractor
												UpperCAmelCase					=			False






						def      UpperCAmelCase__					( self			:Optional[Any]       ,  lowercase_			:Any=None       ,  lowercase_			:Tuple=None       ,  lowercase_			:List[Any]=True )    ->      Optional[int]:
												return self.tokenizer.get_decoder_prompt_ids(task=lowercase_       ,  language=lowercase_       ,  no_timestamps=lowercase_ )






						def __call__( self			:Any       ,  *lowercase_			:Any       ,  **lowercase_			:List[str] )    ->      Optional[int]:
												# For backward compatibility
												if self._in_target_context_manager:
																		return self.current_processor(*lowercase_       ,  **lowercase_ )

												UpperCAmelCase					=			kwargs.pop('audio'       ,  lowercase_ )
												UpperCAmelCase					=			kwargs.pop('sampling_rate'       ,  lowercase_ )
												UpperCAmelCase					=			kwargs.pop('text'       ,  lowercase_ )
												if len(lowercase_ ) > 0:
																		UpperCAmelCase					=			args[0]
																		UpperCAmelCase					=			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:
																		UpperCAmelCase					=			self.feature_extractor(lowercase_       ,  *lowercase_       ,  sampling_rate=lowercase_       ,  **lowercase_ )
												if text is not None:
																		UpperCAmelCase					=			self.tokenizer(lowercase_       ,  **lowercase_ )

												if text is None:
																		return inputs

												elif audio is None:
																		return encodings
												else:
																		UpperCAmelCase					=			encodings['input_ids']
																		return inputs






						def      UpperCAmelCase__					( self			:str       ,  *lowercase_			:Union[str, Any]       ,  **lowercase_			:Union[str, Any] )    ->      str:
												return self.tokenizer.batch_decode(*lowercase_       ,  **lowercase_ )






						def      UpperCAmelCase__					( self			:Any       ,  *lowercase_			:List[str]       ,  **lowercase_			:Optional[int] )    ->      Dict:
												return self.tokenizer.decode(*lowercase_       ,  **lowercase_ )






						def      UpperCAmelCase__					( self			:int       ,  lowercase_			:str       ,  lowercase_			:Optional[int]="np" )    ->      Dict:
												return self.tokenizer.get_prompt_ids(lowercase_       ,  return_tensors=lowercase_ )










"""simple docstring"""


import os
import random
import sys

from . import cryptomath_module as cryptomath
from . import rabin_miller

snake_case_    					=	3

def 			_lowerCAmelCase				(       lowercase_						):
						print('Generating primitive root of p'						)
						while True:
												UpperCAmelCase					=			random.randrange(3		,     lowercase_						)
												if pow(lowercase_		,     2		,     lowercase_						) == 1:
																		continue
												if pow(lowercase_		,     lowercase_		,     lowercase_						) == 1:
																		continue
												return g

def 			_lowerCAmelCase				(       lowercase_						):
						print('Generating prime p...'						)
						UpperCAmelCase					=			rabin_miller.generate_large_prime(lowercase_						)  # select large prime number.
						UpperCAmelCase					=			primitive_root(lowercase_						)  # one primitive root on modulo p.
						UpperCAmelCase					=			random.randrange(3		,     lowercase_						)  # private_key -> have to be greater than 2 for safety.
						UpperCAmelCase					=			cryptomath.find_mod_inverse(pow(lowercase_		,     lowercase_		,     lowercase_						)		,     lowercase_						)

						UpperCAmelCase					=			(key_size, e_a, e_a, p)
						UpperCAmelCase					=			(key_size, d)

						return public_key, private_key

def 			_lowerCAmelCase				(       lowercase_		,     lowercase_						):
						if os.path.exists(F"""{name}_pubkey.txt"""						) or os.path.exists(F"""{name}_privkey.txt"""						):
												print('\nWARNING:'						)
												print(
												    F"""\"{name}_pubkey.txt\" or \"{name}_privkey.txt\" already exists. \n"""
												    'Use a different name or delete these files and re-run this program.'						)
												sys.exit()

						UpperCAmelCase				,   UpperCAmelCase					=			generate_key(lowercase_						)
						print(F"""\nWriting public key to file {name}_pubkey.txt..."""						)
						with open(F"""{name}_pubkey.txt"""		,     'w'						) as fo:
												fo.write(F"""{public_key[0]},{public_key[1]},{public_key[2]},{public_key[3]}"""						)

						print(F"""Writing private key to file {name}_privkey.txt..."""						)
						with open(F"""{name}_privkey.txt"""		,     'w'						) as fo:
												fo.write(F"""{private_key[0]},{private_key[1]}"""						)

def 			_lowerCAmelCase				(       ):
						print('Making key files...'						)
						make_key_files('elgamal'		,     2048						)
						print('Key files generation successful'						)


if __name__ == "__main__":
				main()





