
'''simple docstring'''





import os
import random
import sys

from . import cryptomath_module as cryptoMath  # noqa: N812
from . import rabin_miller as rabinMiller  # noqa: N812

def      A (       ):
						print('''Making key files...'''       )
						make_key_files('''rsa'''    ,							1024       )
						print('''Key files generation successful.'''       )

def      A (       A_							:					int       ):
						print('''Generating prime p...'''       )
						snake_case       :     Dict =    rabinMiller.generate_large_prime(A_       )
						print('''Generating prime q...'''       )
						snake_case       :     Union[str, Any] =    rabinMiller.generate_large_prime(A_       )
						snake_case       :     Optional[Any] =    p * q

						print('''Generating e that is relatively prime to (p - 1) * (q - 1)...'''       )
						while True:
												snake_case       :     int =    random.randrange(2 ** (key_size - 1)    ,							2 ** (key_size)       )
												if cryptoMath.gcd(A_    ,							(p - 1) * (q - 1)       ) == 1:
																		break

						print('''Calculating d that is mod inverse of e...'''       )
						snake_case       :     List[Any] =    cryptoMath.find_mod_inverse(A_    ,							(p - 1) * (q - 1)       )

						snake_case       :     int =    (n, e)
						snake_case       :     Optional[int] =    (n, d)
						return (public_key, private_key)

def      A (       A_							:					str    ,							A_							:					int       ):
						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()

						snake_case,					snake_case       :     int =    generate_key(A_       )
						print(F"""\nWriting public key to file {name}_pubkey.txt..."""       )
						with open(F"""{name}_pubkey.txt"""    ,							'''w'''       ) as out_file:
												out_file.write(F"""{key_size},{public_key[0]},{public_key[1]}"""       )

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


if __name__ == "__main__":
						main()



'''simple docstring'''





import warnings

from ...utils import logging
from .image_processing_layoutlmva import LayoutLMvaImageProcessor


UpperCAmelCase    					=   logging.get_logger(__name__)

class 						a   (				__magic_name__    ):




				def __init__(							self	:				Union[str, Any],    *SCREAMING_SNAKE_CASE_	:				Tuple,    **SCREAMING_SNAKE_CASE_	:				Tuple      ):
										warnings.warn(
										    '''The class LayoutLMv2FeatureExtractor is deprecated and will be removed in version 5 of Transformers.'''
										    ''' Please use LayoutLMv2ImageProcessor instead.''',    SCREAMING_SNAKE_CASE_,    )
										super().__init__(*SCREAMING_SNAKE_CASE_,    **SCREAMING_SNAKE_CASE_      )

