


"""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 		lowercase							(     )     ->None:
	"""simple docstring"""





	print('''Making key files...'''     )
	make_key_files('''rsa'''     ,   1_024     )
	print('''Key files generation successful.'''     )






def 		lowercase							(     _snake_case						:      int     )     ->tuple[tuple[int, int], tuple[int, int]]:
	"""simple docstring"""





	print('''Generating prime p...'''     )
	__snake_case	:						Any						=				rabinMiller.generate_large_prime(_snake_case     )
	print('''Generating prime q...'''     )
	__snake_case	:						Any						=				rabinMiller.generate_large_prime(_snake_case     )
	__snake_case	:						Optional[Any]						=				p * q

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

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

	__snake_case	:						str						=				(n, e)
	__snake_case	:						List[str]						=				(n, d)
	return (public_key, private_key)






def 		lowercase							(     _snake_case						:      str     ,   _snake_case						:      int     )     ->None:
	"""simple docstring"""





	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	:						List[str]						=				generate_key(_snake_case     )
	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 pytest

import datasets


# Import fixture modules as plugins
SCREAMING_SNAKE_CASE :    List[Any]									=				["""tests.fixtures.files""", """tests.fixtures.hub""", """tests.fixtures.fsspec"""]






def 		lowercase							(     _snake_case						:      Optional[int]     ,   _snake_case						:      Optional[int]     )     ->Tuple:
	"""simple docstring"""





	for item in items:
		if any(marker in item.keywords for marker in ['''integration''', '''unit''']     ):
			continue
		item.add_marker(pytest.mark.unit     )






def 		lowercase							(     _snake_case						:      List[str]     )     ->Optional[int]:
	"""simple docstring"""





	config.addinivalue_line('''markers'''     ,   '''torchaudio_latest: mark test to run with torchaudio>=0.12'''     )






@pytest.fixture(autouse=_snake_case     )
def 		lowercase							(     _snake_case						:      Optional[Any]     ,   _snake_case						:      Dict     )     ->Any:
	"""simple docstring"""





	__snake_case	:						List[Any]						=				tmp_path_factory.getbasetemp() / '''cache'''
	__snake_case	:						int						=				test_hf_cache_home / '''datasets'''
	__snake_case	:						Tuple						=				test_hf_cache_home / '''metrics'''
	__snake_case	:						List[str]						=				test_hf_cache_home / '''modules'''
	monkeypatch.setattr('''datasets.config.HF_DATASETS_CACHE'''     ,   str(_snake_case     )     )
	monkeypatch.setattr('''datasets.config.HF_METRICS_CACHE'''     ,   str(_snake_case     )     )
	monkeypatch.setattr('''datasets.config.HF_MODULES_CACHE'''     ,   str(_snake_case     )     )
	__snake_case	:						Optional[int]						=				test_hf_datasets_cache / '''downloads'''
	monkeypatch.setattr('''datasets.config.DOWNLOADED_DATASETS_PATH'''     ,   str(_snake_case     )     )
	__snake_case	:						Tuple						=				test_hf_datasets_cache / '''downloads''' / '''extracted'''
	monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH'''     ,   str(_snake_case     )     )






@pytest.fixture(autouse=_snake_case     ,   scope='''session'''     )
def 		lowercase							(     )     ->Any:
	"""simple docstring"""





	datasets.disable_progress_bar()






@pytest.fixture(autouse=_snake_case     )
def 		lowercase							(     _snake_case						:      Tuple     )     ->Union[str, Any]:
	"""simple docstring"""





	monkeypatch.setattr('''datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'''     ,   _snake_case     )






@pytest.fixture
def 		lowercase							(     _snake_case						:      Any     )     ->Optional[Any]:
	"""simple docstring"""





	monkeypatch.setattr('''sqlalchemy.util.deprecations.SILENCE_UBER_WARNING'''     ,   _snake_case     )





