



'''simple docstring'''




UpperCamelCase__ :			List[str]												=				'''ABCDEFGHIJKLMNOPQRSTUVWXYZ'''


def        lowerCAmelCase_     (			):
		__SCREAMING_SNAKE_CASE :	Optional[Any]					 =	input("""Enter message: """      )
		__SCREAMING_SNAKE_CASE :	Dict					 =	input("""Enter key [alphanumeric]: """      )
		__SCREAMING_SNAKE_CASE :	Optional[int]					 =	input("""Encrypt/Decrypt [e/d]: """      )

		if mode.lower().startswith("""e"""      ):
				__SCREAMING_SNAKE_CASE :	Tuple					 =	"""encrypt"""
				__SCREAMING_SNAKE_CASE :	Dict					 =	encrypt_message(_lowerCamelCase ,   _lowerCamelCase      )
		elif mode.lower().startswith("""d"""      ):
				__SCREAMING_SNAKE_CASE :	Union[str, Any]					 =	"""decrypt"""
				__SCREAMING_SNAKE_CASE :	Union[str, Any]					 =	decrypt_message(_lowerCamelCase ,   _lowerCamelCase      )

		print(F"\n{mode.title()}ed message:"      )
		print(_lowerCamelCase      )


def        lowerCAmelCase_     (			_lowerCamelCase:     str ,   _lowerCamelCase:     str      ):
		return translate_message(_lowerCamelCase ,   _lowerCamelCase ,   """encrypt"""      )


def        lowerCAmelCase_     (			_lowerCamelCase:     str ,   _lowerCamelCase:     str      ):
		return translate_message(_lowerCamelCase ,   _lowerCamelCase ,   """decrypt"""      )


def        lowerCAmelCase_     (			_lowerCamelCase:     str ,   _lowerCamelCase:     str ,   _lowerCamelCase:     str      ):
		__SCREAMING_SNAKE_CASE :	Tuple					 =	[]
		__SCREAMING_SNAKE_CASE :	str					 =	0
		__SCREAMING_SNAKE_CASE :	List[Any]					 =	key.upper()

		for symbol in message:
				__SCREAMING_SNAKE_CASE :	Any					 =	LETTERS.find(symbol.upper()      )
				if num != -1:
						if mode == "encrypt":
								num += LETTERS.find(key[key_index]      )
						elif mode == "decrypt":
								num -= LETTERS.find(key[key_index]      )

						num %= len(_lowerCamelCase      )

						if symbol.isupper():
								translated.append(LETTERS[num]      )
						elif symbol.islower():
								translated.append(LETTERS[num].lower()      )

						key_index += 1
						if key_index == len(_lowerCamelCase      ):
								__SCREAMING_SNAKE_CASE :	List[Any]					 =	0
				else:
						translated.append(_lowerCamelCase      )
		return "".join(_lowerCamelCase      )


if __name__ == "__main__":
						main()




'''simple docstring'''




from unittest.mock import Mock, patch

from file_transfer.send_file import send_file


@patch("""socket.socket"""      )
@patch("""builtins.open"""      )
def        lowerCAmelCase_     (			_lowerCamelCase:     Dict ,   _lowerCamelCase:     List[Any]      ):
		# ===== initialization =====
		__SCREAMING_SNAKE_CASE :	Optional[int]					 =	Mock()
		__SCREAMING_SNAKE_CASE :	Optional[int]					 =	conn, Mock()
		__SCREAMING_SNAKE_CASE :	str					 =	iter([1, None]      )
		__SCREAMING_SNAKE_CASE :	Any					 =	lambda _lowerCamelCase      : next(_lowerCamelCase      )

		# ===== invoke =====
		send_file(filename="""mytext.txt""" ,   testing=_lowerCamelCase      )

		# ===== ensurance =====
		sock.assert_called_once()
		sock.return_value.bind.assert_called_once()
		sock.return_value.listen.assert_called_once()
		sock.return_value.accept.assert_called_once()
		conn.recv.assert_called_once()

		file.return_value.__enter__.assert_called_once()
		file.return_value.__enter__.return_value.read.assert_called()

		conn.send.assert_called_once()
		conn.close.assert_called_once()
		sock.return_value.shutdown.assert_called_once()
		sock.return_value.close.assert_called_once()