'''simple docstring'''
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
      import torch

if is_vision_available():
      from PIL import Image

      from transformers import MobileNetVaImageProcessor







class lowerCamelCase				(						unittest.TestCase       ):




  '''simple docstring'''



  def __init__(   self      :							List[str]	,				UpperCAmelCase__      :							Union[str, Any]	,				UpperCAmelCase__      :							List[str]=7	,				UpperCAmelCase__      :							Union[str, Any]=3	,				UpperCAmelCase__      :							Optional[Any]=18	,				UpperCAmelCase__      :							List[Any]=30	,				UpperCAmelCase__      :							Union[str, Any]=400	,				UpperCAmelCase__      :							List[str]=True	,				UpperCAmelCase__      :							List[Any]=None	,				UpperCAmelCase__      :							Dict=True	,				UpperCAmelCase__      :							List[str]=None	,				)					->Optional[Any]:
        UpperCAmelCase_      =	size if size is not None else {'''shortest_edge''': 20}
        UpperCAmelCase_      =	crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}
        UpperCAmelCase_      =	parent
        UpperCAmelCase_      =	batch_size
        UpperCAmelCase_      =	num_channels
        UpperCAmelCase_      =	image_size
        UpperCAmelCase_      =	min_resolution
        UpperCAmelCase_      =	max_resolution
        UpperCAmelCase_      =	do_resize
        UpperCAmelCase_      =	size
        UpperCAmelCase_      =	do_center_crop
        UpperCAmelCase_      =	crop_size






  def 			lowerCAmelCase__			(   self      :							List[Any]	)					->List[Any]:
        return {
            "do_resize": self.do_resize,
            "size": self.size,
            "do_center_crop": self.do_center_crop,
            "crop_size": self.crop_size,
        }







@require_torch
@require_vision
class lowerCamelCase				(						lowerCamelCase  ,		unittest.TestCase       ):




  '''simple docstring'''



  lowerCAmelCase__      				=						MobileNetVaImageProcessor if is_vision_available() else None






  def 			lowerCAmelCase__			(   self      :							List[str]	)					->Optional[Any]:
        UpperCAmelCase_      =	MobileNetVaImageProcessingTester(self	)






  @property
  def 			lowerCAmelCase__			(   self      :							Union[str, Any]	)					->Optional[Any]:
        return self.image_processor_tester.prepare_image_processor_dict()






  def 			lowerCAmelCase__			(   self      :							Tuple	)					->str:
        UpperCAmelCase_      =	self.image_processing_class(**self.image_processor_dict	)
        self.assertTrue(hasattr(UpperCAmelCase__	,				'''do_resize'''	)	)
        self.assertTrue(hasattr(UpperCAmelCase__	,				'''size'''	)	)
        self.assertTrue(hasattr(UpperCAmelCase__	,				'''do_center_crop'''	)	)
        self.assertTrue(hasattr(UpperCAmelCase__	,				'''crop_size'''	)	)






  def 			lowerCAmelCase__			(   self      :							int	)					->Optional[int]:
        UpperCAmelCase_      =	self.image_processing_class.from_dict(self.image_processor_dict	)
        self.assertEqual(image_processor.size	,				{'''shortest_edge''': 20}	)
        self.assertEqual(image_processor.crop_size	,				{'''height''': 18, '''width''': 18}	)

        UpperCAmelCase_      =	self.image_processing_class.from_dict(self.image_processor_dict	,				size=42	,				crop_size=84	)
        self.assertEqual(image_processor.size	,				{'''shortest_edge''': 42}	)
        self.assertEqual(image_processor.crop_size	,				{'''height''': 84, '''width''': 84}	)






  def 			lowerCAmelCase__			(   self      :							Optional[int]	)					->Union[str, Any]:
        pass






  def 			lowerCAmelCase__			(   self      :							List[Any]	)					->List[str]:
        UpperCAmelCase_      =	self.image_processing_class(**self.image_processor_dict	)
        # create random PIL images
        UpperCAmelCase_      =	prepare_image_inputs(self.image_processor_tester	,				equal_resolution=UpperCAmelCase__	)
        for image in image_inputs:
              self.assertIsInstance(UpperCAmelCase__	,				Image.Image	)

        # Test not batched input
        UpperCAmelCase_      =	image_processing(image_inputs[0]	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                1,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)

        # Test batched
        UpperCAmelCase_      =	image_processing(UpperCAmelCase__	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                self.image_processor_tester.batch_size,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)






  def 			lowerCAmelCase__			(   self      :							Any	)					->Optional[Any]:
        UpperCAmelCase_      =	self.image_processing_class(**self.image_processor_dict	)
        # create random numpy tensors
        UpperCAmelCase_      =	prepare_image_inputs(self.image_processor_tester	,				equal_resolution=UpperCAmelCase__	,				numpify=UpperCAmelCase__	)
        for image in image_inputs:
              self.assertIsInstance(UpperCAmelCase__	,				np.ndarray	)

        # Test not batched input
        UpperCAmelCase_      =	image_processing(image_inputs[0]	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                1,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)

        # Test batched
        UpperCAmelCase_      =	image_processing(UpperCAmelCase__	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                self.image_processor_tester.batch_size,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)






  def 			lowerCAmelCase__			(   self      :							str	)					->str:
        UpperCAmelCase_      =	self.image_processing_class(**self.image_processor_dict	)
        # create random PyTorch tensors
        UpperCAmelCase_      =	prepare_image_inputs(self.image_processor_tester	,				equal_resolution=UpperCAmelCase__	,				torchify=UpperCAmelCase__	)
        for image in image_inputs:
              self.assertIsInstance(UpperCAmelCase__	,				torch.Tensor	)

        # Test not batched input
        UpperCAmelCase_      =	image_processing(image_inputs[0]	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                1,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)

        # Test batched
        UpperCAmelCase_      =	image_processing(UpperCAmelCase__	,				return_tensors='''pt'''	).pixel_values
        self.assertEqual(
            encoded_images.shape	,				(
                self.image_processor_tester.batch_size,
                self.image_processor_tester.num_channels,
                self.image_processor_tester.crop_size['''height'''],
                self.image_processor_tester.crop_size['''width'''],
            )	,				)









import requests
from bsa import BeautifulSoup
def 							UpperCamelCase_(					_A :str = "AAPL"	)->		str:
			UpperCamelCase__       =							F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}'''
			UpperCamelCase__       =							BeautifulSoup(requests.get(_A	).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}''')


