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


lowerCAmelCase_     =	logging.get_logger(__name__)

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

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

lowerCAmelCase_     =	{
    '''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'''
        ),
    },
}
lowerCAmelCase_     =	{F"funnel-transformer/{name}": 512 for name in _model_names}
lowerCAmelCase_     =	{F"funnel-transformer/{name}": {'''do_lower_case''': True} for name in _model_names}




class  _snake_case		(    __snake_case ):







				"""simple docstring"""






				a			=						VOCAB_FILES_NAMES
				a			=						PRETRAINED_VOCAB_FILES_MAP
				a			=						PRETRAINED_INIT_CONFIGURATION
				a			=						FunnelTokenizer
				a			=						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				a			=						2





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



											"""simple docstring"""







											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      ,    bos_token=_A      ,    eos_token=_A      ,    clean_text=_A      ,    tokenize_chinese_chars=_A      ,    strip_accents=_A      ,    wordpieces_prefix=_A      ,    **_A      ,    )

											_SCREAMING_SNAKE_CASE		:						Dict			  =    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
											):
																		_SCREAMING_SNAKE_CASE		:						List[str]			  =    getattr(_A      ,    normalizer_state.pop("""type"""))
																		_SCREAMING_SNAKE_CASE		:						Tuple			  =    do_lower_case
																		_SCREAMING_SNAKE_CASE		:						Optional[Any]			  =    strip_accents
																		_SCREAMING_SNAKE_CASE		:						Any			  =    tokenize_chinese_chars
																		_SCREAMING_SNAKE_CASE		:						Tuple			  =    normalizer_class(**_A)

											_SCREAMING_SNAKE_CASE		:						Dict			  =    do_lower_case





				def 		_lowerCAmelCase		(      self							:							int      ,    _A							:							Optional[int]      ,    _A							:							List[str]=None):



											"""simple docstring"""







											_SCREAMING_SNAKE_CASE		:						List[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							:							Optional[int]      ,    _A							:							List[int]      ,    _A							:							Optional[List[int]] = None):



											"""simple docstring"""







											_SCREAMING_SNAKE_CASE		:						Tuple			  =    [self.sep_token_id]
											_SCREAMING_SNAKE_CASE		:						Optional[int]			  =    [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							:							Tuple      ,    _A							:							str      ,    _A							:							Optional[str] = None):



											"""simple docstring"""







											_SCREAMING_SNAKE_CASE		:						Tuple			  =    self._tokenizer.model.save(_A      ,    name=_A)
											return tuple(_A)



"""simple docstring"""





from decimal import Decimal, getcontext
from math import ceil, factorial



def      lowerCamelCase_(__SCREAMING_SNAKE_CASE  )->    str:

							if not isinstance(__SCREAMING_SNAKE_CASE     ,	__SCREAMING_SNAKE_CASE  ):
														raise TypeError("""Undefined for non-integers"""  )
							elif precision < 1:
														raise ValueError("""Undefined for non-natural numbers"""  )

							_SCREAMING_SNAKE_CASE		:						int			  =    precision
							_SCREAMING_SNAKE_CASE		:						Dict			  =    ceil(precision / 14  )
							_SCREAMING_SNAKE_CASE		:						int			  =    426_880 * Decimal(10_005  ).sqrt()
							_SCREAMING_SNAKE_CASE		:						Union[str, Any]			  =    1
							_SCREAMING_SNAKE_CASE		:						str			  =    13_591_409
							_SCREAMING_SNAKE_CASE		:						Tuple			  =    Decimal(__SCREAMING_SNAKE_CASE  )
							for k in range(1     ,	__SCREAMING_SNAKE_CASE  ):
														_SCREAMING_SNAKE_CASE		:						Tuple			  =    factorial(6 * k  ) // (factorial(3 * k  ) * factorial(__SCREAMING_SNAKE_CASE  ) ** 3)
														linear_term += 545_140_134
														exponential_term *= -262_537_412_640_768_000
														partial_sum += Decimal(multinomial_term * linear_term  ) / exponential_term
							return str(constant_term / partial_sum  )[:-1]


if __name__ == "__main__":
			lowerCAmelCase_     =	50
			print(F"The first {n} digits of pi is: {pi(n)}")


