






'''simple docstring'''




import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
		from .tokenization_big_bird import BigBirdTokenizer
else:
		lowerCAmelCase__          =						None

lowerCAmelCase__          =						logging.get_logger(__name__)
lowerCAmelCase__          =						{'vocab_file': 'spiece.model', 'tokenizer_file': 'tokenizer.json'}

lowerCAmelCase__          =						{
    'vocab_file': {
        'google/bigbird-roberta-base': 'https://huggingface.co/google/bigbird-roberta-base/resolve/main/spiece.model',
        'google/bigbird-roberta-large': (
            'https://huggingface.co/google/bigbird-roberta-large/resolve/main/spiece.model'
        ),
        'google/bigbird-base-trivia-itc': (
            'https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/spiece.model'
        ),
    },
    'tokenizer_file': {
        'google/bigbird-roberta-base': (
            'https://huggingface.co/google/bigbird-roberta-base/resolve/main/tokenizer.json'
        ),
        'google/bigbird-roberta-large': (
            'https://huggingface.co/google/bigbird-roberta-large/resolve/main/tokenizer.json'
        ),
        'google/bigbird-base-trivia-itc': (
            'https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/tokenizer.json'
        ),
    },
}

lowerCAmelCase__          =						{
    'google/bigbird-roberta-base': 4096,
    'google/bigbird-roberta-large': 4096,
    'google/bigbird-base-trivia-itc': 4096,
}


lowerCAmelCase__          =						'▁'







class       __lowercase					(__lowerCamelCase    ):
	_lowerCamelCase              =  VOCAB_FILES_NAMES
	_lowerCamelCase              =  PRETRAINED_VOCAB_FILES_MAP
	_lowerCamelCase              =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	_lowerCamelCase              =  BigBirdTokenizer
	_lowerCamelCase              =  ['''input_ids''', '''attention_mask''']
	_lowerCamelCase              =  []

	def __init__(      self   :						int  ,					UpperCAmelCase_   :						List[Any]=None  ,					UpperCAmelCase_   :						Optional[Any]=None  ,					UpperCAmelCase_   :						List[str]="<unk>"  ,					UpperCAmelCase_   :						Tuple="<s>"  ,					UpperCAmelCase_   :						Tuple="</s>"  ,					UpperCAmelCase_   :						Optional[int]="<pad>"  ,					UpperCAmelCase_   :						Optional[Any]="[SEP]"  ,					UpperCAmelCase_   :						List[Any]="[MASK]"  ,					UpperCAmelCase_   :						Any="[CLS]"  ,					**UpperCAmelCase_   :						Tuple  ,					):
			UpperCamelCase__				:					str					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else bos_token
			UpperCamelCase__				:					Optional[int]					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else eos_token
			UpperCamelCase__				:					Any					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else unk_token
			UpperCamelCase__				:					Union[str, Any]					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else pad_token
			UpperCamelCase__				:					Dict					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else cls_token
			UpperCamelCase__				:					List[Any]					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else sep_token

			# Mask token behave like a normal word, i.e. include the space before it
			UpperCamelCase__				:					Tuple					=					AddedToken(UpperCAmelCase_  ,					lstrip=UpperCAmelCase_  ,					rstrip=UpperCAmelCase_) if isinstance(UpperCAmelCase_  ,					UpperCAmelCase_) else mask_token

			super().__init__(
			    UpperCAmelCase_  ,					tokenizer_file=UpperCAmelCase_  ,					bos_token=UpperCAmelCase_  ,					eos_token=UpperCAmelCase_  ,					unk_token=UpperCAmelCase_  ,					sep_token=UpperCAmelCase_  ,					pad_token=UpperCAmelCase_  ,					cls_token=UpperCAmelCase_  ,					mask_token=UpperCAmelCase_  ,					**UpperCAmelCase_  ,					)

			UpperCamelCase__				:					int					=					vocab_file
			UpperCamelCase__				:					Tuple					=					False if not self.vocab_file else True

	def      __UpperCamelCase							(      self   :						List[str]  ,					UpperCAmelCase_   :						List[int]  ,					UpperCAmelCase_   :						Optional[List[int]] = None):
			UpperCamelCase__				:					Optional[Any]					=					[self.sep_token_id]
			UpperCamelCase__				:					int					=					[self.cls_token_id]
			if token_ids_a is None:
					return cls + token_ids_a + sep
			return cls + token_ids_a + sep + token_ids_a + sep

	def      __UpperCamelCase							(      self   :						Tuple  ,					UpperCAmelCase_   :						List[int]  ,					UpperCAmelCase_   :						Optional[List[int]] = None  ,					UpperCAmelCase_   :						bool = False):

			if already_has_special_tokens:
					if token_ids_a is not None:
							raise ValueError(
							    'You should not supply a second sequence if the provided sequence of '
							    'ids is already formatted with special tokens for the model.')
					return [1 if x in [self.sep_token_id, self.cls_token_id] else 0 for x in token_ids_a]

			if token_ids_a is None:
					return [1] + ([0] * len(UpperCAmelCase_)) + [1]
			return [1] + ([0] * len(UpperCAmelCase_)) + [1] + ([0] * len(UpperCAmelCase_)) + [1]

	def      __UpperCamelCase							(      self   :						Optional[int]  ,					UpperCAmelCase_   :						List[int]  ,					UpperCAmelCase_   :						Optional[List[int]] = None):
			UpperCamelCase__				:					Dict					=					[self.sep_token_id]
			UpperCamelCase__				:					str					=					[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      __UpperCamelCase							(      self   :						Optional[int]  ,					UpperCAmelCase_   :						str  ,					UpperCAmelCase_   :						Optional[str] = None):
			if not self.can_save_slow_tokenizer:
					raise ValueError(
					    'Your fast tokenizer does not have the necessary information to save the vocabulary for a slow '
					    'tokenizer.')

			if not os.path.isdir(UpperCAmelCase_):
					logger.error(F'Vocabulary path ({save_directory}) should be a directory')
					return
			UpperCamelCase__				:					Optional[int]					=					os.path.join(
			    UpperCAmelCase_  ,					(filename_prefix + '-' if filename_prefix else '') + VOCAB_FILES_NAMES['vocab_file'])

			if os.path.abspath(self.vocab_file) != os.path.abspath(UpperCAmelCase_):
					copyfile(self.vocab_file  ,					UpperCAmelCase_)

			return (out_vocab_file,)












'''simple docstring'''




import requests
from bsa import BeautifulSoup







def       __UpperCAmelCase						(  lowerCamelCase_ = "AAPL")							->     str:
		UpperCamelCase__				:					str					=					f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'
		UpperCamelCase__				:					Optional[Any]					=					BeautifulSoup(requests.get(lowerCamelCase_).text     ,      'html.parser')
		UpperCamelCase__				:					Union[str, Any]					=					'My(6px) Pos(r) smartphone_Mt(6px)'
		return soup.find('div'     ,      class_=class_).find('span').text


if __name__ == "__main__":
		for symbol in "AAPL AMZN IBM GOOG MSFT ORCL".split():
				print(f'''Current {symbol:<4} stock price is {stock_price(symbol):>8}''')




