






import argparse
from collections import defaultdict




def      lowercase__      (     __snake_case    :							Optional[int]     ,       __snake_case    :							Optional[Any]     ,       __snake_case    :							Optional[Any]     ,       __snake_case    :							Any     ,       __snake_case    :							int  ):


					'''simple docstring'''


					UpperCAmelCase_    :      Union[str, Any]            =						F"{file}_{class_name}_{test_name}"
					done_test[_id] += 1

					with open(__snake_case     ,       'r'  ) as f:
										UpperCAmelCase_    :      Optional[int]            =						f.readlines()

					UpperCAmelCase_    :      Optional[Any]            =						F"class {class_name}("
					UpperCAmelCase_    :      Tuple            =						F"{4 * ' '}def {test_name}("
					UpperCAmelCase_    :      Dict            =						F"{8 * ' '}{correct_line.split()[0]}"
					UpperCAmelCase_    :      Any            =						F"{16 * ' '}{correct_line.split()[0]}"
					UpperCAmelCase_    :      Any            =						False
					UpperCAmelCase_    :      Union[str, Any]            =						False
					UpperCAmelCase_    :      List[str]            =						False
					UpperCAmelCase_    :      str            =						False
					UpperCAmelCase_    :      Dict            =						0
					UpperCAmelCase_    :      Tuple            =						0

					UpperCAmelCase_    :      str            =						[]
					for line in lines:
										if line.startswith(__snake_case  ):
															UpperCAmelCase_    :      Tuple            =						True
										elif in_class and line.startswith(__snake_case  ):
															UpperCAmelCase_    :      Dict            =						True
										elif in_class and in_func and (line.startswith(__snake_case  ) or line.startswith(__snake_case  )):
															UpperCAmelCase_    :      int            =						len(line.split(correct_line.split()[0]  )[0]  )
															count += 1

															if count == done_test[_id]:
																				UpperCAmelCase_    :      List[Any]            =						True

										if in_class and in_func and in_line:
															if ")" not in line:
																				continue
															else:
																				UpperCAmelCase_    :      Optional[Any]            =						True

										if in_class and in_func and in_line and insert_line:
															new_lines.append(F"{spaces * ' '}{correct_line}"  )
															UpperCAmelCase_    :      Dict            =						False
										else:
															new_lines.append(__snake_case  )

					with open(__snake_case     ,       'w'  ) as f:
										for line in new_lines:
															f.write(__snake_case  )




def      lowercase__      (     __snake_case    :							Tuple     ,       __snake_case    :							Union[str, Any]=None  ):


					'''simple docstring'''


					if fail is not None:
										with open(__snake_case     ,       'r'  ) as f:
															UpperCAmelCase_    :      Dict            =						{l.strip() for l in f.readlines()}
					else:
										UpperCAmelCase_    :      Union[str, Any]            =						None

					with open(__snake_case     ,       'r'  ) as f:
										UpperCAmelCase_    :      Optional[Any]            =						f.readlines()

					UpperCAmelCase_    :      List[str]            =						defaultdict(__snake_case  )
					for line in correct_lines:
										UpperCAmelCase_       ,  UpperCAmelCase_       ,  UpperCAmelCase_       ,  UpperCAmelCase_    :      int            =						line.split(';'  )
										if test_failures is None or "::".join([file, class_name, test_name]  ) in test_failures:
															overwrite_file(__snake_case     ,       __snake_case     ,       __snake_case     ,       __snake_case     ,       __snake_case  )


if __name__ == "__main__":
		__UpperCAmelCase								=						argparse.ArgumentParser()
		parser.add_argument('--correct_filename', help='filename of tests with expected result')
		parser.add_argument('--fail_filename', help='filename of test failures', type=str, default=None)
		__UpperCAmelCase								=						parser.parse_args()

		main(args.correct_filename, args.fail_filename)














import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


UpperCAmelCase__				   =		{"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

UpperCAmelCase__				   =		{
    "vocab_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt"
        ),
        "google/electra-base-generator": "https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt",
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-generator": (
            "https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json"
        ),
    },
}

UpperCAmelCase__				   =		{
    "google/electra-small-generator": 512,
    "google/electra-base-generator": 512,
    "google/electra-large-generator": 512,
    "google/electra-small-discriminator": 512,
    "google/electra-base-discriminator": 512,
    "google/electra-large-discriminator": 512,
}

UpperCAmelCase__				   =		{
    "google/electra-small-generator": {"do_lower_case": True},
    "google/electra-base-generator": {"do_lower_case": True},
    "google/electra-large-generator": {"do_lower_case": True},
    "google/electra-small-discriminator": {"do_lower_case": True},
    "google/electra-base-discriminator": {"do_lower_case": True},
    "google/electra-large-discriminator": {"do_lower_case": True},
}






class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      __snake_case       =  VOCAB_FILES_NAMES
      __snake_case       =  PRETRAINED_VOCAB_FILES_MAP
      __snake_case       =  PRETRAINED_INIT_CONFIGURATION
      __snake_case       =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      __snake_case       =  ElectraTokenizer







      def __init__(      self      :						Dict ,					__UpperCAmelCase      :						int=None ,					__UpperCAmelCase      :						str=None ,					__UpperCAmelCase      :						Optional[int]=True ,					__UpperCAmelCase      :						str="[UNK]" ,					__UpperCAmelCase      :						Any="[SEP]" ,					__UpperCAmelCase      :						str="[PAD]" ,					__UpperCAmelCase      :						Optional[Any]="[CLS]" ,					__UpperCAmelCase      :						Union[str, Any]="[MASK]" ,					__UpperCAmelCase      :						List[str]=True ,					__UpperCAmelCase      :						Tuple=None ,					**__UpperCAmelCase      :						Optional[int] ,					)    ->str:




       """simple docstring"""


       super().__init__(
           __UpperCAmelCase ,					tokenizer_file=__UpperCAmelCase ,					do_lower_case=__UpperCAmelCase ,					unk_token=__UpperCAmelCase ,					sep_token=__UpperCAmelCase ,					pad_token=__UpperCAmelCase ,					cls_token=__UpperCAmelCase ,					mask_token=__UpperCAmelCase ,					tokenize_chinese_chars=__UpperCAmelCase ,					strip_accents=__UpperCAmelCase ,					**__UpperCAmelCase ,					)

       a		  =      json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
       if (
           normalizer_state.get('''lowercase''' ,					__UpperCAmelCase  ) != do_lower_case
           or normalizer_state.get('''strip_accents''' ,					__UpperCAmelCase  ) != strip_accents
           or normalizer_state.get('''handle_chinese_chars''' ,					__UpperCAmelCase  ) != tokenize_chinese_chars
       ):
        a		  =      getattr(__UpperCAmelCase ,					normalizer_state.pop('''type'''  )  )
        a		  =      do_lower_case
        a		  =      strip_accents
        a		  =      tokenize_chinese_chars
        a		  =      normalizer_class(**__UpperCAmelCase  )

       a		  =      do_lower_case







      def       __lowerCAmelCase					(      self      :						List[Any] ,					__UpperCAmelCase      :						Optional[int] ,					__UpperCAmelCase      :						Tuple=None  )    ->str:




       """simple docstring"""


       a		  =      [self.cls_token_id] + token_ids_a + [self.sep_token_id]

       if token_ids_a:
        output += token_ids_a + [self.sep_token_id]

       return output







      def       __lowerCAmelCase					(      self      :						Optional[Any] ,					__UpperCAmelCase      :						List[int] ,					__UpperCAmelCase      :						Optional[List[int]] = None  )    ->List[int]:




       """simple docstring"""


       a		  =      [self.sep_token_id]
       a		  =      [self.cls_token_id]
       if token_ids_a is None:
        return len(cls + token_ids_a + sep  ) * [0]
       return len(cls + token_ids_a + sep  ) * [0] + len(token_ids_a + sep  ) * [1]







      def       __lowerCAmelCase					(      self      :						List[str] ,					__UpperCAmelCase      :						str ,					__UpperCAmelCase      :						Optional[str] = None  )    ->Tuple[str]:




       """simple docstring"""


       a		  =      self._tokenizer.model.save(__UpperCAmelCase ,					name=__UpperCAmelCase  )
       return tuple(__UpperCAmelCase  )


