






def   __lowercase       (			snake_case			):







				"""simple docstring"""






				__magic_name__		:str   =   current_set.copy()
				for row_index, row in enumerate(snake_case			):
								__magic_name__		:Tuple   =   row[0]
								for column_index, column in enumerate(snake_case			):
												if magnitude == 0:
																__magic_name__		:Optional[Any]   =   column
																continue
												__magic_name__		:Union[str, Any]   =   column / magnitude
    # Subtract to cancel term
				__magic_name__		:List[str]   =   current_set[0]
				__magic_name__		:List[Any]   =   [first_row]
				__magic_name__		:Any   =   current_set[1::]
				for row in current_set:
								__magic_name__		:str   =   []
								# If first term is 0, it is already in form we want, so we preserve it
								if row[0] == 0:
												final_set.append(snake_case			)
												continue
								for column_index in range(len(snake_case			)			):
												temp_row.append(first_row[column_index] - row[column_index]			)
								final_set.append(snake_case			)
				# Create next recursion iteration set
				if len(final_set[0]			) != 3:
								__magic_name__		:Tuple   =   final_set[0]
								__magic_name__		:List[Any]   =   []
								__magic_name__		:int   =   []
								for row in final_set[1::]:
												current_first_column.append(row[0]			)
												next_iteration.append(row[1::]			)
								__magic_name__		:int   =   simplify(snake_case			)
								for i in range(len(snake_case			)			):
												resultant[i].insert(0,	current_first_column[i]			)
								resultant.insert(0,	snake_case			)
								__magic_name__		:Any   =   resultant
				return final_set

def   __lowercase       (			snake_case			):







				"""simple docstring"""






				if len(snake_case			) == 0:
								raise IndexError('''solve_simultaneous() requires n lists of length n+1'''			)
				__magic_name__		:int   =   len(snake_case			) + 1
				if any(len(snake_case			) != _length for item in equations			):
								raise IndexError('''solve_simultaneous() requires n lists of length n+1'''			)
				for row in equations:
								if any(not isinstance(snake_case,	(int, float)			) for column in row			):
												raise ValueError('''solve_simultaneous() requires lists of integers'''			)
				if len(snake_case			) == 1:
								return [equations[0][-1] / equations[0][0]]
				__magic_name__		:List[Any]   =   equations.copy()
				if any(0 in row for row in data_set			):
								__magic_name__		:Any   =   data_set.copy()
								__magic_name__		:List[str]   =   []
								for row_index, row in enumerate(snake_case			):
												if 0 not in row:
																__magic_name__		:Any   =   data_set.pop(snake_case			)
																break
								if not full_row:
												raise ValueError('''solve_simultaneous() requires at least 1 full equation'''			)
								data_set.insert(0,	snake_case			)
				__magic_name__		:Tuple   =   data_set.copy()
				__magic_name__		:Optional[Any]   =   simplify(snake_case			)
				__magic_name__		:Optional[Any]   =   simplified[::-1]
				__magic_name__		:list   =   []
				for row in simplified:
								__magic_name__		:int   =   row[-1]
								if not solutions:
												if row[-2] == 0:
																solutions.append(0			)
																continue
												solutions.append(current_solution / row[-2]			)
												continue
								__magic_name__		:Union[str, Any]   =   row.copy()[: len(snake_case			) - 1 :]
								while temp_row[0] == 0:
												temp_row.pop(0			)
								if len(snake_case			) == 0:
												solutions.append(0			)
												continue
								__magic_name__		:Dict   =   temp_row[1::]
								__magic_name__		:Any   =   temp_row[::-1]
								for column_index, column in enumerate(snake_case			):
												current_solution -= column * solutions[column_index]
								solutions.append(snake_case			)
				__magic_name__		:List[Any]   =   []
				for item in solutions:
								final.append(float(round(snake_case,	5			)			)			)
				return final[::-1]


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					SCREAMING_SNAKE_CASE__   :      List[str]				=		[
					    [2, 1, 1, 1, 1, 4],
					    [1, 2, 1, 1, 1, 5],
					    [1, 1, 2, 1, 1, 6],
					    [1, 1, 1, 2, 1, 7],
					    [1, 1, 1, 1, 2, 8],
					]
					print(solve_simultaneous(eq))
					print(solve_simultaneous([[4, 2]]))








"""simple docstring"""






import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_funnel import FunnelTokenizer


__SCREAMING_SNAKE_CASE							=     logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE							=     {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

__SCREAMING_SNAKE_CASE							=     [
    'small',
    'small-base',
    'medium',
    'medium-base',
    'intermediate',
    'intermediate-base',
    'large',
    'large-base',
    'xlarge',
    'xlarge-base',
]

__SCREAMING_SNAKE_CASE							=     {
    'vocab_file': {
        'funnel-transformer/small': 'https://huggingface.co/funnel-transformer/small/resolve/main/vocab.txt',
        'funnel-transformer/small-base': 'https://huggingface.co/funnel-transformer/small-base/resolve/main/vocab.txt',
        'funnel-transformer/medium': 'https://huggingface.co/funnel-transformer/medium/resolve/main/vocab.txt',
        'funnel-transformer/medium-base': (
            'https://huggingface.co/funnel-transformer/medium-base/resolve/main/vocab.txt'
        ),
        'funnel-transformer/intermediate': (
            'https://huggingface.co/funnel-transformer/intermediate/resolve/main/vocab.txt'
        ),
        'funnel-transformer/intermediate-base': (
            'https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/vocab.txt'
        ),
        'funnel-transformer/large': 'https://huggingface.co/funnel-transformer/large/resolve/main/vocab.txt',
        'funnel-transformer/large-base': 'https://huggingface.co/funnel-transformer/large-base/resolve/main/vocab.txt',
        'funnel-transformer/xlarge': 'https://huggingface.co/funnel-transformer/xlarge/resolve/main/vocab.txt',
        'funnel-transformer/xlarge-base': (
            'https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/vocab.txt'
        ),
    },
    'tokenizer_file': {
        'funnel-transformer/small': 'https://huggingface.co/funnel-transformer/small/resolve/main/tokenizer.json',
        'funnel-transformer/small-base': (
            'https://huggingface.co/funnel-transformer/small-base/resolve/main/tokenizer.json'
        ),
        'funnel-transformer/medium': 'https://huggingface.co/funnel-transformer/medium/resolve/main/tokenizer.json',
        'funnel-transformer/medium-base': (
            'https://huggingface.co/funnel-transformer/medium-base/resolve/main/tokenizer.json'
        ),
        'funnel-transformer/intermediate': (
            'https://huggingface.co/funnel-transformer/intermediate/resolve/main/tokenizer.json'
        ),
        'funnel-transformer/intermediate-base': (
            'https://huggingface.co/funnel-transformer/intermediate-base/resolve/main/tokenizer.json'
        ),
        'funnel-transformer/large': 'https://huggingface.co/funnel-transformer/large/resolve/main/tokenizer.json',
        'funnel-transformer/large-base': (
            'https://huggingface.co/funnel-transformer/large-base/resolve/main/tokenizer.json'
        ),
        'funnel-transformer/xlarge': 'https://huggingface.co/funnel-transformer/xlarge/resolve/main/tokenizer.json',
        'funnel-transformer/xlarge-base': (
            'https://huggingface.co/funnel-transformer/xlarge-base/resolve/main/tokenizer.json'
        ),
    },
}
__SCREAMING_SNAKE_CASE							=     {F"""funnel-transformer/{name}""": 512 for name in _model_names}
__SCREAMING_SNAKE_CASE							=     {F"""funnel-transformer/{name}""": {'do_lower_case': True} for name in _model_names}





class 				a__					(						A__       ):
     UpperCAmelCase__         =      VOCAB_FILES_NAMES
     UpperCAmelCase__         =      PRETRAINED_VOCAB_FILES_MAP
     UpperCAmelCase__         =      PRETRAINED_INIT_CONFIGURATION
     UpperCAmelCase__         =      FunnelTokenizer
     UpperCAmelCase__         =      PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     UpperCAmelCase__         =      2



     def __init__(							self :str      ,  _lowerCamelCase :int=None      ,  _lowerCamelCase :List[Any]=None      ,  _lowerCamelCase :Dict=True      ,  _lowerCamelCase :Optional[Any]="<unk>"      ,  _lowerCamelCase :Optional[Any]="<sep>"      ,  _lowerCamelCase :List[Any]="<pad>"      ,  _lowerCamelCase :List[Any]="<cls>"      ,  _lowerCamelCase :Union[str, Any]="<mask>"      ,  _lowerCamelCase :Any="<s>"      ,  _lowerCamelCase :Union[str, Any]="</s>"      ,  _lowerCamelCase :str=True      ,  _lowerCamelCase :Dict=True      ,  _lowerCamelCase :Tuple=None      ,  _lowerCamelCase :Tuple="##"      ,  **_lowerCamelCase :int      ,  ):







      '''simple docstring'''



      super().__init__(
          _lowerCamelCase      ,  tokenizer_file=_lowerCamelCase      ,  do_lower_case=_lowerCamelCase      ,  unk_token=_lowerCamelCase      ,  sep_token=_lowerCamelCase      ,  pad_token=_lowerCamelCase      ,  cls_token=_lowerCamelCase      ,  mask_token=_lowerCamelCase      ,  bos_token=_lowerCamelCase      ,  eos_token=_lowerCamelCase      ,  clean_text=_lowerCamelCase      ,  tokenize_chinese_chars=_lowerCamelCase      ,  strip_accents=_lowerCamelCase      ,  wordpieces_prefix=_lowerCamelCase      ,  **_lowerCamelCase      ,  )

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

      UpperCamelCase_     :					Dict   	=do_lower_case



     def  lowerCamelCase_						(							self :Optional[int]      ,  _lowerCamelCase :str      ,  _lowerCamelCase :Optional[int]=None   ):







      '''simple docstring'''



      UpperCamelCase_     :					Optional[Any]   	=[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 :List[Any]      ,  _lowerCamelCase :List[int]      ,  _lowerCamelCase :Optional[List[int]] = None   ):







      '''simple docstring'''



      UpperCamelCase_     :					Optional[int]   	=[self.sep_token_id]
      UpperCamelCase_     :					List[Any]   	=[self.cls_token_id]
      if token_ids_a is None:
       return len(cls   ) * [self.cls_token_type_id] + len(token_ids_a + sep   ) * [0]
      return len(cls   ) * [self.cls_token_type_id] + len(token_ids_a + sep   ) * [0] + len(token_ids_a + sep   ) * [1]




     def  lowerCamelCase_						(							self :Optional[Any]      ,  _lowerCamelCase :str      ,  _lowerCamelCase :Optional[str] = None   ):







      '''simple docstring'''



      UpperCamelCase_     :					int   	=self._tokenizer.model.save(_lowerCamelCase      ,  name=_lowerCamelCase   )
      return tuple(_lowerCamelCase   )
