'''simple docstring'''


import unittest

from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
					from PIL import Image
else:






					class 						A   :





												@staticmethod
												def       snake_case__						(      *__a				:							Dict     ,		**__a				:							Tuple	)							->	int:
													pass






@is_pipeline_test
@require_torch
@require_vision
class 						A   (   unittest.TestCase   ):
							a_        =      MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING





							def       snake_case__						(      self				:							Optional[int]     ,		__a				:							Optional[int]     ,		__a				:							Optional[int]     ,		__a				:							Optional[Any]	)							->	List[str]:
								__UpperCAmelCase							=			pipeline('''visual-question-answering'''     ,		model='''hf-internal-testing/tiny-vilt-random-vqa'''	)
								__UpperCAmelCase							=			[
								    {
								        '''image''': Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''	),
								        '''question''': '''How many cats are there?''',
								    },
								    {
								        '''image''': '''./tests/fixtures/tests_samples/COCO/000000039769.png''',
								        '''question''': '''How many cats are there?''',
								    },
								]
								return vqa_pipeline, examples





							def       snake_case__						(      self				:							List[str]     ,		__a				:							Tuple     ,		__a				:							Any	)							->	Dict:
								__UpperCAmelCase							=			vqa_pipeline(__a     ,		top_k=1	)
								self.assertEqual(
								    __a     ,		[
								        [{'''score''': ANY(__a	), '''answer''': ANY(__a	)}],
								        [{'''score''': ANY(__a	), '''answer''': ANY(__a	)}],
								    ]     ,		)





							@require_torch
							def       snake_case__						(      self				:							Tuple	)							->	Union[str, Any]:
								__UpperCAmelCase							=			pipeline('''visual-question-answering'''     ,		model='''hf-internal-testing/tiny-vilt-random-vqa'''	)
								__UpperCAmelCase							=			'''./tests/fixtures/tests_samples/COCO/000000039769.png'''
								__UpperCAmelCase							=			'''How many cats are there?'''

								__UpperCAmelCase							=			vqa_pipeline(image=__a     ,		question='''How many cats are there?'''     ,		top_k=2	)
								self.assertEqual(
								    __a     ,		[{'''score''': ANY(__a	), '''answer''': ANY(__a	)}, {'''score''': ANY(__a	), '''answer''': ANY(__a	)}]	)

								__UpperCAmelCase							=			vqa_pipeline({'''image''': image, '''question''': question}     ,		top_k=2	)
								self.assertEqual(
								    __a     ,		[{'''score''': ANY(__a	), '''answer''': ANY(__a	)}, {'''score''': ANY(__a	), '''answer''': ANY(__a	)}]	)





							@slow
							@require_torch
							def       snake_case__						(      self				:							Optional[Any]	)							->	List[Any]:
								__UpperCAmelCase							=			pipeline('''visual-question-answering'''     ,		model='''dandelin/vilt-b32-finetuned-vqa'''	)
								__UpperCAmelCase							=			'''./tests/fixtures/tests_samples/COCO/000000039769.png'''
								__UpperCAmelCase							=			'''How many cats are there?'''

								__UpperCAmelCase							=			vqa_pipeline(image=__a     ,		question=__a     ,		top_k=2	)
								self.assertEqual(
								    nested_simplify(__a     ,		decimals=4	)     ,		[{'''score''': 0.8_7_9_9, '''answer''': '''2'''}, {'''score''': 0.2_9_6, '''answer''': '''1'''}]	)

								__UpperCAmelCase							=			vqa_pipeline({'''image''': image, '''question''': question}     ,		top_k=2	)
								self.assertEqual(
								    nested_simplify(__a     ,		decimals=4	)     ,		[{'''score''': 0.8_7_9_9, '''answer''': '''2'''}, {'''score''': 0.2_9_6, '''answer''': '''1'''}]	)

								__UpperCAmelCase							=			vqa_pipeline(
								    [{'''image''': image, '''question''': question}, {'''image''': image, '''question''': question}]     ,		top_k=2	)
								self.assertEqual(
								    nested_simplify(__a     ,		decimals=4	)     ,		[[{'''score''': 0.8_7_9_9, '''answer''': '''2'''}, {'''score''': 0.2_9_6, '''answer''': '''1'''}]] * 2     ,		)






							@require_tf
							@unittest.skip('''Visual question answering not implemented in TF'''	)
							def       snake_case__						(      self				:							Tuple	)							->	str:
								pass






'''simple docstring'''


import requests
from bsa import BeautifulSoup





def       lowerCAmelCase					(		UpperCamelCase__				:   str = "AAPL"       ):


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