"""simple docstring"""




import argparse
from collections import defaultdict





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Optional[int]			,_lowerCamelCase						:       Tuple			,_lowerCamelCase						:       Union[str, Any]			,_lowerCamelCase						:       Optional[int]			,_lowerCamelCase						:       Any	)       ->      int:
  _lowerCAmelCase						:       Optional[int]  			=     f"{file}_{class_name}_{test_name}"
  done_test[_id] += 1

  with open(_lowerCamelCase			,"""r"""	) as f:
    _lowerCAmelCase						:       Any  			=     f.readlines()

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

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

      if count == done_test[_id]:
        _lowerCAmelCase						:       Optional[int]  			=     True

    if in_class and in_func and in_line:
      if ")" not in line:
        continue
      else:
        _lowerCAmelCase						:       int  			=     True

    if in_class and in_func and in_line and insert_line:
      new_lines.append(f"{spaces * ' '}{correct_line}"	)
      _lowerCAmelCase						:       Union[str, Any]  			=     False
    else:
      new_lines.append(_lowerCamelCase	)

  with open(_lowerCamelCase			,"""w"""	) as f:
    for line in new_lines:
      f.write(_lowerCamelCase	)





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Any			,_lowerCamelCase						:       Tuple=None	)       ->      Union[str, Any]:
  if fail is not None:
    with open(_lowerCamelCase			,"""r"""	) as f:
      _lowerCAmelCase						:       Optional[int]  			=     {l.strip() for l in f.readlines()}
  else:
    _lowerCAmelCase						:       List[Any]  			=     None

  with open(_lowerCamelCase			,"""r"""	) as f:
    _lowerCAmelCase						:       str  			=     f.readlines()

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


if __name__ == "__main__":
     _a      :		Optional[int]           =   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)
     _a      :		List[str]           =   parser.parse_args()

     main(args.correct_filename, args.fail_filename)





"""simple docstring"""




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


_a      :		List[Any]           =   {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

_a      :		Union[str, Any]           =   {
    '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'
        ),
    },
}

_a      :		Optional[Any]           =   {
    '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,
}

_a      :		Any           =   {
    '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 						__A							( SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:			Tuple							=		VOCAB_FILES_NAMES
     _UpperCamelCase							:			List[Any]							=		PRETRAINED_VOCAB_FILES_MAP
     _UpperCamelCase							:			List[Any]							=		PRETRAINED_INIT_CONFIGURATION
     _UpperCamelCase							:			Union[str, Any]							=		PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     _UpperCamelCase							:			Optional[Any]							=		ElectraTokenizer






     def __init__(		self				,     a__=None				,     a__=None				,     a__=True				,     a__="[UNK]"				,     a__="[SEP]"				,     a__="[PAD]"				,     a__="[CLS]"				,     a__="[MASK]"				,     a__=True				,     a__=None				,     **a__				,     ):
       super().__init__(
           a__				,     tokenizer_file=a__				,     do_lower_case=a__				,     unk_token=a__				,     sep_token=a__				,     pad_token=a__				,     cls_token=a__				,     mask_token=a__				,     tokenize_chinese_chars=a__				,     strip_accents=a__				,     **a__				,     )

       _lowerCAmelCase						:       int  			=     json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
       if (
           normalizer_state.get("""lowercase"""				,     a__  ) != do_lower_case
           or normalizer_state.get("""strip_accents"""				,     a__  ) != strip_accents
           or normalizer_state.get("""handle_chinese_chars"""				,     a__  ) != tokenize_chinese_chars
       ):
         _lowerCAmelCase						:       Dict  			=     getattr(a__				,     normalizer_state.pop("""type"""  )  )
         _lowerCAmelCase						:       int  			=     do_lower_case
         _lowerCAmelCase						:       str  			=     strip_accents
         _lowerCAmelCase						:       Dict  			=     tokenize_chinese_chars
         _lowerCAmelCase						:       str  			=     normalizer_class(**a__  )

       _lowerCAmelCase						:       List[str]  			=     do_lower_case






     def     __A  (		self				,     a__				,     a__=None  ):
       _lowerCAmelCase						:       int  			=     [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     __A  (		self				,     a__				,     a__ = None  ):
       _lowerCAmelCase						:       List[str]  			=     [self.sep_token_id]
       _lowerCAmelCase						:       Any  			=     [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     __A  (		self				,     a__				,     a__ = None  ):
       _lowerCAmelCase						:       Optional[Any]  			=     self._tokenizer.model.save(a__				,     name=a__  )
       return tuple(a__  )




