



"""simple docstring"""







import random
import sys

from . import cryptomath_module as cryptomath

A     =      (
    r' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`'
    r'abcdefghijklmnopqrstuvwxyz{|}~'
)

def 	lowerCAmelCase__      (  lowerCamelCase__					,   lowerCamelCase__					,   lowerCamelCase__      )			->				None:
							if mode == "encrypt":
														if key_a == 1:
																					sys.exit(
																					    'The affine cipher becomes weak when key '
																					    'A is set to 1. Choose different key'      )
														if key_b == 0:
																					sys.exit(
																					    'The affine cipher becomes weak when key '
																					    'B is set to 0. Choose different key'      )
							if key_a < 0 or key_b < 0 or key_b > len(lowerCamelCase__      ) - 1:
														sys.exit(
														    'Key A must be greater than 0 and key B must '
														    f"""be between 0 and {len(lowerCamelCase__      ) - 1}."""      )
							if cryptomath.gcd(lowerCamelCase__					,   len(lowerCamelCase__      )      ) != 1:
														sys.exit(
														    f"""Key A {key_a} and the symbol set size {len(lowerCamelCase__      )} """
														    'are not relatively prime. Choose a different key.'      )

def 	lowerCAmelCase__      (  lowerCamelCase__					,   lowerCamelCase__      )			->				str:
							A   ,	A    =       divmod(lowerCamelCase__					,   len(lowerCamelCase__      )      )
							check_keys(lowerCamelCase__					,   lowerCamelCase__					,   'encrypt'      )
							A    =       ''
							for symbol in message:
														if symbol in SYMBOLS:
																					A    =       SYMBOLS.find(lowerCamelCase__      )
																					cipher_text += SYMBOLS[(sym_index * key_a + key_b) % len(lowerCamelCase__      )]
														else:
																					cipher_text += symbol
							return cipher_text

def 	lowerCAmelCase__      (  lowerCamelCase__					,   lowerCamelCase__      )			->				str:
							A   ,	A    =       divmod(lowerCamelCase__					,   len(lowerCamelCase__      )      )
							check_keys(lowerCamelCase__					,   lowerCamelCase__					,   'decrypt'      )
							A    =       ''
							A    =       cryptomath.find_mod_inverse(lowerCamelCase__					,   len(lowerCamelCase__      )      )
							for symbol in message:
														if symbol in SYMBOLS:
																					A    =       SYMBOLS.find(lowerCamelCase__      )
																					plain_text += SYMBOLS[
																					    (sym_index - key_b) * mod_inverse_of_key_a % len(lowerCamelCase__      )
																					]
														else:
																					plain_text += symbol
							return plain_text

def 	lowerCAmelCase__      (  )			->				int:
							while True:
														A    =       random.randint(2					,   len(lowerCamelCase__      )      )
														A    =       random.randint(2					,   len(lowerCamelCase__      )      )
														if cryptomath.gcd(lowerCamelCase__					,   len(lowerCamelCase__      )      ) == 1 and key_b % len(lowerCamelCase__      ) != 0:
																					return key_b * len(lowerCamelCase__      ) + key_b

def 	lowerCAmelCase__      (  )			->				None:
							A    =       input('Enter message: '      ).strip()
							A    =       int(input('Enter key [2000 - 9000]: '      ).strip()      )
							A    =       input('Encrypt/Decrypt [E/D]: '      ).strip().lower()

							if mode.startswith('e'      ):
														A    =       'encrypt'
														A    =       encrypt_message(lowerCamelCase__					,   lowerCamelCase__      )
							elif mode.startswith('d'      ):
														A    =       'decrypt'
														A    =       decrypt_message(lowerCamelCase__					,   lowerCamelCase__      )
							print(f"""\n{mode.title()}ed text: \n{translated}"""      )


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							# main()








"""simple docstring"""







import os

from ...utils import logging
from .utils import DataProcessor, InputExample


A     =      logging.get_logger(__name__)






class   UpperCAmelCase__		(   UpperCamelCase  ):



		def __init__(			self	:     List[str]   ,				snake_case	:     List[Any]   ,				snake_case	:     str=None					)      ->    Tuple:






									'''simple docstring'''

									A    =       language
									A    =       train_language



		def        A_		(			self	:     Optional[int]   ,				snake_case	:     Any					)      ->    Union[str, Any]:






									'''simple docstring'''

									A    =       self.language if self.train_language is None else self.train_language
									A    =       self._read_tsv(os.path.join(snake_case   ,				f"""XNLI-MT-1.0/multinli/multinli.train.{lg}.tsv"""					)					)
									A    =       []
									for i, line in enumerate(snake_case					):
																if i == 0:
																							continue
																A    =       f"""train-{i}"""
																A    =       line[0]
																A    =       line[1]
																A    =       'contradiction' if line[2] == 'contradictory' else line[2]
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training input {text_a} is not a string"""					)
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training input {text_b} is not a string"""					)
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training label {label} is not a string"""					)
																examples.append(InputExample(guid=snake_case   ,				text_a=snake_case   ,				text_b=snake_case   ,				label=snake_case					)					)
									return examples



		def        A_		(			self	:     int   ,				snake_case	:     int					)      ->    Optional[int]:






									'''simple docstring'''

									A    =       self._read_tsv(os.path.join(snake_case   ,				'XNLI-1.0/xnli.test.tsv'					)					)
									A    =       []
									for i, line in enumerate(snake_case					):
																if i == 0:
																							continue
																A    =       line[0]
																if language != self.language:
																							continue
																A    =       f"""test-{i}"""
																A    =       line[6]
																A    =       line[7]
																A    =       line[1]
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training input {text_a} is not a string"""					)
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training input {text_b} is not a string"""					)
																if not isinstance(snake_case   ,				snake_case					):
																							raise ValueError(f"""Training label {label} is not a string"""					)
																examples.append(InputExample(guid=snake_case   ,				text_a=snake_case   ,				text_b=snake_case   ,				label=snake_case					)					)
									return examples



		def        A_		(			self	:     Any					)      ->    List[Any]:






									'''simple docstring'''

									return ["contradiction", "entailment", "neutral"]



A     =      {
    'xnli': XnliProcessor,
}

A     =      {
    'xnli': 'classification',
}

A     =      {
    'xnli': 3,
}



