





import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers.testing_utils import require_vision
from transformers.utils import is_vision_available


if is_vision_available():
					from PIL import Image

					from transformers import AutoProcessor, BlipaProcessor, BlipImageProcessor, GPTaTokenizer, PreTrainedTokenizerFast

@require_vision
class 							__SCREAMING_SNAKE_CASE       (  unittest.TestCase							):






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      tempfile.mkdtemp()

														UpperCamelCase__					  =      BlipImageProcessor()
														UpperCamelCase__					  =      GPTaTokenizer.from_pretrained("""hf-internal-testing/tiny-random-GPT2Model"""	)

														UpperCamelCase__					  =      BlipaProcessor(UpperCamelCase_	,			UpperCamelCase_	)

														processor.save_pretrained(self.tmpdirname	)






							def 					_lowerCamelCase		(    self	,			**__lowerCAmelCase	):
														return AutoProcessor.from_pretrained(self.tmpdirname	,			**UpperCamelCase_	).tokenizer






							def 					_lowerCamelCase		(    self	,			**__lowerCAmelCase	):
														return AutoProcessor.from_pretrained(self.tmpdirname	,			**UpperCamelCase_	).image_processor






							def 					_lowerCamelCase		(    self	):
														shutil.rmtree(self.tmpdirname	)






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      [np.random.randint(255	,			size=(3, 30, 400)	,			dtype=np.uinta	)]

														UpperCamelCase__					  =      [Image.fromarray(np.moveaxis(UpperCamelCase_	,			0	,			-1	)	) for x in image_inputs]

														return image_inputs






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      BlipaProcessor(tokenizer=self.get_tokenizer()	,			image_processor=self.get_image_processor()	)
														processor.save_pretrained(self.tmpdirname	)

														UpperCamelCase__					  =      self.get_tokenizer(bos_token="""(BOS)"""	,			eos_token="""(EOS)"""	)
														UpperCamelCase__					  =      self.get_image_processor(do_normalize=UpperCamelCase_	,			padding_value=1.0	)

														UpperCamelCase__					  =      BlipaProcessor.from_pretrained(
														    self.tmpdirname	,			bos_token="""(BOS)"""	,			eos_token="""(EOS)"""	,			do_normalize=UpperCamelCase_	,			padding_value=1.0	)

														self.assertEqual(processor.tokenizer.get_vocab()	,			tokenizer_add_kwargs.get_vocab()	)
														self.assertIsInstance(processor.tokenizer	,			UpperCamelCase_	)

														self.assertEqual(processor.image_processor.to_json_string()	,			image_processor_add_kwargs.to_json_string()	)
														self.assertIsInstance(processor.image_processor	,			UpperCamelCase_	)






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      self.get_image_processor()
														UpperCamelCase__					  =      self.get_tokenizer()

														UpperCamelCase__					  =      BlipaProcessor(tokenizer=UpperCamelCase_	,			image_processor=UpperCamelCase_	)

														UpperCamelCase__					  =      self.prepare_image_inputs()

														UpperCamelCase__					  =      image_processor(UpperCamelCase_	,			return_tensors="""np"""	)
														UpperCamelCase__					  =      processor(images=UpperCamelCase_	,			return_tensors="""np"""	)

														for key in input_feat_extract.keys():
																					self.assertAlmostEqual(input_feat_extract[key].sum()	,			input_processor[key].sum()	,			delta=1E-2	)






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      self.get_image_processor()
														UpperCamelCase__					  =      self.get_tokenizer()

														UpperCamelCase__					  =      BlipaProcessor(tokenizer=UpperCamelCase_	,			image_processor=UpperCamelCase_	)

														UpperCamelCase__					  =      '''lower newer'''

														UpperCamelCase__					  =      processor(text=UpperCamelCase_	)

														UpperCamelCase__					  =      tokenizer(UpperCamelCase_	,			return_token_type_ids=UpperCamelCase_	)

														for key in encoded_tok.keys():
																					self.assertListEqual(encoded_tok[key]	,			encoded_processor[key]	)






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      self.get_image_processor()
														UpperCamelCase__					  =      self.get_tokenizer()

														UpperCamelCase__					  =      BlipaProcessor(tokenizer=UpperCamelCase_	,			image_processor=UpperCamelCase_	)

														UpperCamelCase__					  =      '''lower newer'''
														UpperCamelCase__					  =      self.prepare_image_inputs()

														UpperCamelCase__					  =      processor(text=UpperCamelCase_	,			images=UpperCamelCase_	)

														self.assertListEqual(list(inputs.keys()	)	,			["""pixel_values""", """input_ids""", """attention_mask"""]	)

														# test if it raises when no input is passed
														with pytest.raises(UpperCamelCase_	):
																					processor()






							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      self.get_image_processor()
														UpperCamelCase__					  =      self.get_tokenizer()

														UpperCamelCase__					  =      BlipaProcessor(tokenizer=UpperCamelCase_	,			image_processor=UpperCamelCase_	)

														UpperCamelCase__					  =      [[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

														UpperCamelCase__					  =      processor.batch_decode(UpperCamelCase_	)
														UpperCamelCase__					  =      tokenizer.batch_decode(UpperCamelCase_	)

														self.assertListEqual(UpperCamelCase_	,			UpperCamelCase_	)







							def 					_lowerCamelCase		(    self	):
														UpperCamelCase__					  =      self.get_image_processor()
														UpperCamelCase__					  =      self.get_tokenizer()

														UpperCamelCase__					  =      BlipaProcessor(tokenizer=UpperCamelCase_	,			image_processor=UpperCamelCase_	)

														UpperCamelCase__					  =      '''lower newer'''
														UpperCamelCase__					  =      self.prepare_image_inputs()

														UpperCamelCase__					  =      processor(text=UpperCamelCase_	,			images=UpperCamelCase_	)

														# For now the processor supports only ['pixel_values', 'input_ids', 'attention_mask']
														self.assertListEqual(list(inputs.keys()	)	,			["""pixel_values""", """input_ids""", """attention_mask"""]	)








'''simple docstring'''
import requests
from bsa import BeautifulSoup


def      a (     __a = "AAPL"  )    ->      str:



					'''simple docstring'''






					UpperCamelCase__  :str				   =					f'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
					UpperCamelCase__  :Tuple				   =					BeautifulSoup(requests.get(__a  ).text					,   '''html.parser'''  )
					UpperCamelCase__  :Tuple				   =					'''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}""")