






"""simple docstring"""



import json
import os
import pickle
import subprocess
from hashlib import mda
from pathlib import Path
from tempfile import gettempdir
from textwrap import dedent
from types import CodeType, FunctionType
from unittest import TestCase
from unittest.mock import patch

import pytest
from multiprocess import Pool
from packaging import version

import datasets
from datasets.fingerprint import Hasher, fingerprint_transform
from datasets.table import InMemoryTable

from .utils import (
    require_regex,
    require_spacy,
    require_spacy_model,
    require_tiktoken,
    require_torch,
    require_transformers,
)


class 	_UpperCamelCase :



    '''simple docstring'''


    def __init__(      self   ,			__lowercase			):
     UpperCAmelCase__ 						=				foo






    def __call__(      self			):
     return self.foo



class 	_UpperCamelCase ( datasets.Dataset							):



    '''simple docstring'''


    @fingerprint_transform(inplace=__lowercase			)
    def 		A__      (      self   ,			__lowercase   ,			*__lowercase   ,			**__lowercase			):
     return DatasetChild(self.data   ,			fingerprint=__lowercase			)






    @fingerprint_transform(inplace=__lowercase			)
    def 		A__      (      self   ,			__lowercase   ,			*__lowercase   ,			**__lowercase			):
     return DatasetChild(self.data   ,			fingerprint=__lowercase			)



class 	_UpperCamelCase :



    '''simple docstring'''


    def __init__(      self   ,			__lowercase			):
     UpperCAmelCase__ 						=				callable


    def __call__(      self   ,			*__lowercase   ,			**__lowercase			):
     if self.callable is not None:
      return self.callable(*__lowercase   ,			**__lowercase			)






    def __getstate__(      self			):
     raise pickle.PicklingError()



class 	_UpperCamelCase ( __UpperCamelCase							):



    '''simple docstring'''


    @require_transformers
    @pytest.mark.integration
    def 		A__      (      self			):
     from transformers import AutoTokenizer

     def encode(__lowercase			):
      return tokenizer(__lowercase			)

     # TODO: add hash consistency tests across sessions
     UpperCAmelCase__ 						=				AutoTokenizer.from_pretrained("""bert-base-uncased"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(lambda __lowercase			: tokenizer(__lowercase			)			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				AutoTokenizer.from_pretrained("""bert-base-cased"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(lambda __lowercase			: tokenizer(__lowercase			)			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				AutoTokenizer.from_pretrained("""bert-base-uncased"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(lambda __lowercase			: tokenizer(__lowercase			)			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    @require_transformers
    @pytest.mark.integration
    def 		A__      (      self			):
     from transformers import AutoTokenizer

     UpperCAmelCase__ 						=				AutoTokenizer.from_pretrained("""gpt2"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     tokenizer("""Hello world !"""			)  # call once to change the tokenizer's cache
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)






    @require_regex
    def 		A__      (      self			):
     import regex

     UpperCAmelCase__ 						=				regex.Regex("""foo"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				regex.Regex("""bar"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				regex.Regex("""foo"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)



class 	_UpperCamelCase ( __UpperCamelCase							):



    '''simple docstring'''


    def 		A__      (      self			):
     def func():
      return foo

     UpperCAmelCase__ 						=				[0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				[1]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				[0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     def func():
      pass

     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()

     def func():
      pass

     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([0]			)			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([1]			)			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([0]			)			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([0]			).__call__			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([1]			).__call__			)			).hexdigest()
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(Foo([0]			).__call__			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				(
         """co_argcount""",
         """co_kwonlyargcount""",
         """co_nlocals""",
         """co_stacksize""",
         """co_flags""",
         """co_code""",
         """co_consts""",
         """co_names""",
         """co_varnames""",
         """co_filename""",
         """co_name""",
         """co_firstlineno""",
         """co_lnotab""",
         """co_freevars""",
         """co_cellvars""",
     )

     def _create_code_pyaa(*__lowercase			):
      if hasattr(args[-3]   ,			"""encode"""			):
       UpperCAmelCase__ 						=				list(__lowercase			)
       UpperCAmelCase__ 						=				args[-3].encode()  # co_lnotab
       UpperCAmelCase__ 						=				args[-10].encode()  # co_code
      if hasattr(__lowercase   ,			"""co_posonlyargcount"""			):
       if len(__lowercase			) == 16:
        return CodeType(*__lowercase			)
       elif len(__lowercase			) == 15:
        return CodeType(args[0]   ,			0   ,			*args[1:]			)
       return CodeType(args[0]   ,			0   ,			0   ,			*args[1:]			)
      elif hasattr(__lowercase   ,			"""co_kwonlyargcount"""			):
       if len(__lowercase			) == 16:
        return CodeType(args[0]   ,			*args[2:]			)
       elif len(__lowercase			) == 15:
        return CodeType(*__lowercase			)
       return CodeType(args[0]   ,			0   ,			*args[1:]			)
      if len(__lowercase			) == 16:
       return CodeType(args[0]   ,			*args[3:]			)
      elif len(__lowercase			) == 15:
       return CodeType(args[0]   ,			*args[2:]			)
      return CodeType(*__lowercase			)

     def create_ipython_func(__lowercase   ,			__lowercase			):
      def func():
       return returned_obj

      UpperCAmelCase__ 						=				func.__code__
      # Use _create_code from dill in order to make it work for different python versions
      if datasets.config.PY_VERSION < version.parse("""3.8"""			):
       UpperCAmelCase__ 						=				_create_code_pyaa(
           *[getattr(__lowercase   ,			__lowercase			) if k != """co_filename""" else co_filename for k in code_args_pyaa]			)
      else:
       UpperCAmelCase__ 						=				code.replace(co_filename=__lowercase			)
      return FunctionType(__lowercase   ,			func.__globals__   ,			func.__name__   ,			func.__defaults__   ,			func.__closure__			)

     UpperCAmelCase__						,	UpperCAmelCase__ 						=				"""<ipython-input-2-e0383a102aae>""", [0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     UpperCAmelCase__						,	UpperCAmelCase__ 						=				"""<ipython-input-2-e0383a102aae>""", [1]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     UpperCAmelCase__						,	UpperCAmelCase__ 						=				"""<ipython-input-5-713f6613acf3>""", [0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)

     UpperCAmelCase__						,	UpperCAmelCase__ 						=				os.path.join(gettempdir()   ,			"""ipykernel_12345"""   ,			"""321456789.py"""			), [0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     UpperCAmelCase__						,	UpperCAmelCase__ 						=				os.path.join(gettempdir()   ,			"""ipykernel_12345"""   ,			"""321456789.py"""			), [1]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     UpperCAmelCase__						,	UpperCAmelCase__ 						=				os.path.join(gettempdir()   ,			"""ipykernel_12345"""   ,			"""654123987.py"""			), [0]
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(create_ipython_func(__lowercase   ,			__lowercase			)			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)






    def 		A__      (      self			):
     UpperCAmelCase__						,	UpperCAmelCase__ 						=				[0], [1]

     def func():
      return foo, bar

     UpperCAmelCase__ 						=				"""__main__"""

     def globalvars_mocka_side_effect(__lowercase   ,			*__lowercase   ,			**__lowercase			):
      return {"foo": foo, "bar": bar}

     def globalvars_mocka_side_effect(__lowercase   ,			*__lowercase   ,			**__lowercase			):
      return {"bar": bar, "foo": foo}

     with patch("""dill.detect.globalvars"""   ,			side_effect=__lowercase			) as globalvars_mocka:
      UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
      self.assertGreater(globalvars_mocka.call_count   ,			0			)
     with patch("""dill.detect.globalvars"""   ,			side_effect=__lowercase			) as globalvars_mocka:
      UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
      self.assertGreater(globalvars_mocka.call_count   ,			0			)
     self.assertEqual(__lowercase   ,			__lowercase			)



class 	_UpperCamelCase ( __UpperCamelCase							):



    '''simple docstring'''


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				Hasher.hash("""hello"""			)
     UpperCAmelCase__ 						=				Hasher.hash("""hello"""			)
     UpperCAmelCase__ 						=				Hasher.hash("""there"""			)
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				Hasher.hash(Foo("""hello"""			)			)
     UpperCAmelCase__ 						=				Hasher.hash(Foo("""hello"""			)			)
     UpperCAmelCase__ 						=				Hasher.hash(Foo("""there"""			)			)
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				Hasher()
     for x in ["hello", Foo("""hello"""			)]:
      hasher.update(__lowercase			)
     UpperCAmelCase__ 						=				hasher.hexdigest()
     UpperCAmelCase__ 						=				Hasher()
     for x in ["hello", Foo("""hello"""			)]:
      hasher.update(__lowercase			)
     UpperCAmelCase__ 						=				hasher.hexdigest()
     UpperCAmelCase__ 						=				Hasher()
     for x in ["there", Foo("""there"""			)]:
      hasher.update(__lowercase			)
     UpperCAmelCase__ 						=				hasher.hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    def 		A__      (      self			):
     with self.assertRaises(pickle.PicklingError			):
      Hasher.hash(UnpicklableCallable(Foo("""hello"""			)			)			)


    def 		A__      (      self			):
     UpperCAmelCase__ 						=				"""abc"""
     UpperCAmelCase__ 						=				[string, string]  # two strings have the same ids
     UpperCAmelCase__ 						=				[string, string]
     UpperCAmelCase__ 						=				json.loads(F'''["{string}", "{string}"]'''			)  # two strings have different ids
     self.assertIs(obja[0]   ,			__lowercase			)
     self.assertIs(obja[0]   ,			obja[1]			)
     self.assertIs(obja[0]   ,			__lowercase			)
     self.assertIs(obja[0]   ,			obja[1]			)
     self.assertIsNot(obja[0]   ,			__lowercase			)
     self.assertIsNot(obja[0]   ,			obja[1]			)
     UpperCAmelCase__ 						=				Hasher.hash(__lowercase			)
     UpperCAmelCase__ 						=				Hasher.hash(__lowercase			)
     UpperCAmelCase__ 						=				Hasher.hash(__lowercase			)
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertEqual(__lowercase   ,			__lowercase			)


    @require_tiktoken
    def 		A__      (      self			):
     import tiktoken

     UpperCAmelCase__ 						=				tiktoken.get_encoding("""gpt2"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				tiktoken.get_encoding("""r50k_base"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				tiktoken.get_encoding("""gpt2"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)


    @require_torch
    def 		A__      (      self			):
     import torch

     UpperCAmelCase__ 						=				torch.tensor([1.0]			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				torch.tensor([2.0]			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				torch.tensor([1.0]			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)






    @require_spacy
    @require_spacy_model("""en_core_web_sm"""			)
    @require_spacy_model("""fr_core_news_sm"""			)
    @pytest.mark.integration
    def 		A__      (      self			):
     import spacy

     UpperCAmelCase__ 						=				spacy.load("""en_core_web_sm"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				spacy.load("""fr_core_news_sm"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     UpperCAmelCase__ 						=				spacy.load("""en_core_web_sm"""			)
     UpperCAmelCase__ 						=				mda(datasets.utils.py_utils.dumps(__lowercase			)			).hexdigest()
     self.assertEqual(__lowercase   ,			__lowercase			)
     self.assertNotEqual(__lowercase   ,			__lowercase			)




@pytest.mark.integration
def       snake_case__		(   _SCREAMING_SNAKE_CASE			)    ->Union[str, Any]:
 UpperCAmelCase__ 						=				tmp_path / """dir1"""
 UpperCAmelCase__ 						=				tmp_path / """dir2"""
 dira.mkdir()
 dira.mkdir()
 UpperCAmelCase__ 						=				"""script.py"""
 UpperCAmelCase__ 						=				dedent(
     """
    from datasets.fingerprint import Hasher
    def foo():
        pass
    print(Hasher.hash(foo))
    """			)
 UpperCAmelCase__ 						=				dira / script_filename
 UpperCAmelCase__ 						=				dira / script_filename
 with script_patha.open("""w"""			) as f:
  f.write(_SCREAMING_SNAKE_CASE			)
 with script_patha.open("""w"""			) as f:
  f.write(_SCREAMING_SNAKE_CASE			)
 UpperCAmelCase__ 						=				subprocess.check_output(["""python""", str(_SCREAMING_SNAKE_CASE			)]			)
 UpperCAmelCase__ 						=				subprocess.check_output(["""python""", str(_SCREAMING_SNAKE_CASE			)]			)
 assert fingerprinta == fingerprinta




def       snake_case__		(   )    ->str:
 UpperCAmelCase__ 						=				{"""a""": [0, 1, 2]}
 UpperCAmelCase__ 						=				DatasetChild(InMemoryTable.from_pydict(_SCREAMING_SNAKE_CASE			)			)
 UpperCAmelCase__ 						=				dataset.funca()._fingerprint
 assert expected_fingerprint == dataset.funca()._fingerprint
 assert expected_fingerprint != dataset.funca()._fingerprint

 with Pool(2			) as p:
  assert expected_fingerprint == p.apply_async(dataset.funca			).get()._fingerprint
  assert expected_fingerprint != p.apply_async(dataset.funca			).get()._fingerprint




def       snake_case__		(   )    ->List[str]:
 UpperCAmelCase__ 						=				{"""a""": [0, 1, 2]}


 class 	_UpperCamelCase ( datasets.Dataset							):



     '''simple docstring'''


     @fingerprint_transform(inplace=__lowercase			)
     def 		A__      (      self   ,			__lowercase			):
      return DummyDatasetChild(self.data   ,			fingerprint=__lowercase			)



 UpperCAmelCase__ 						=				DummyDatasetChild(InMemoryTable.from_pydict(_SCREAMING_SNAKE_CASE			)			).func()


 class 	_UpperCamelCase ( datasets.Dataset							):



     '''simple docstring'''


     @fingerprint_transform(inplace=__lowercase   ,			version="""1.0.0"""			)
     def 		A__      (      self   ,			__lowercase			):
      return DummyDatasetChild(self.data   ,			fingerprint=__lowercase			)



 UpperCAmelCase__ 						=				DummyDatasetChild(InMemoryTable.from_pydict(_SCREAMING_SNAKE_CASE			)			).func()


 class 	_UpperCamelCase ( datasets.Dataset							):



     '''simple docstring'''


     @fingerprint_transform(inplace=__lowercase   ,			version="""2.0.0"""			)
     def 		A__      (      self   ,			__lowercase			):
      return DummyDatasetChild(self.data   ,			fingerprint=__lowercase			)



 UpperCAmelCase__ 						=				DummyDatasetChild(InMemoryTable.from_pydict(_SCREAMING_SNAKE_CASE			)			).func()

 assert len({fingeprint_no_version, fingeprint_a, fingeprint_a}			) == 3




def       snake_case__		(   )    ->Optional[Any]:
 # AttributeError: module 'dill._dill' has no attribute 'stack'
 UpperCAmelCase__ 						=				Hasher()
 hasher.update(lambda _SCREAMING_SNAKE_CASE			: x			)











"""simple docstring"""



from string import ascii_uppercase




def       snake_case__		(   _SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE       ,	_SCREAMING_SNAKE_CASE = False       ,	_SCREAMING_SNAKE_CASE = ascii_uppercase			)    ->str:
 UpperCAmelCase__ 						=				keyword.upper()
 UpperCAmelCase__ 						=				plaintext.upper()
 UpperCAmelCase__ 						=				set(_SCREAMING_SNAKE_CASE			)

 # create a list of unique characters in the keyword - their order matters
 # it determines how we will map plaintext characters to the ciphertext
 UpperCAmelCase__ 						=				[]
 for char in keyword:
  if char in alphabet_set and char not in unique_chars:
   unique_chars.append(_SCREAMING_SNAKE_CASE			)
    # the number of those unique characters will determine the number of rows
 UpperCAmelCase__ 						=				len(_SCREAMING_SNAKE_CASE			)

 # create a shifted version of the alphabet
 UpperCAmelCase__ 						=				unique_chars + [
     char for char in alphabet if char not in unique_chars
 ]

 # create a modified alphabet by splitting the shifted alphabet into rows
 UpperCAmelCase__ 						=				[
     shifted_alphabet[k : k + num_unique_chars_in_keyword]
     for k in range(0       ,	2_6       ,	_SCREAMING_SNAKE_CASE			)
 ]

 # map the alphabet characters to the modified alphabet characters
 # going 'vertically' through the modified alphabet - consider columns first
 UpperCAmelCase__ 						=				{}
 UpperCAmelCase__ 						=				0
 for column in range(_SCREAMING_SNAKE_CASE			):
  for row in modified_alphabet:
   # if current row (the last one) is too short, break out of loop
   if len(_SCREAMING_SNAKE_CASE			) <= column:
    break

   # map current letter to letter in modified alphabet
   UpperCAmelCase__ 						=				row[column]
   letter_index += 1

 if verbose:
  print(_SCREAMING_SNAKE_CASE			)
 # create the encrypted text by mapping the plaintext to the modified alphabet
 return "".join(mapping[char] if char in mapping else char for char in plaintext			)


if __name__ == "__main__":
 # example use
 print(mixed_keyword('''college''', '''UNIVERSITY'''))



