



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 PoolFormerImageProcessor


class       a							(			unittest.TestCase				):



		def __init__(     self     :int   ,__lowercase     :Union[str, Any]   ,__lowercase     :str=7   ,__lowercase     :List[str]=3   ,__lowercase     :Tuple=3_0   ,__lowercase     :List[str]=4_0_0   ,__lowercase     :Tuple=True   ,__lowercase     :List[Any]=None   ,__lowercase     :Optional[int]=0.9   ,__lowercase     :Dict=None   ,__lowercase     :List[Any]=True   ,__lowercase     :int=[0.5, 0.5, 0.5]   ,__lowercase     :Dict=[0.5, 0.5, 0.5]   ,):
						snake_case__	:      Union[str, Any]     		=	size if size is not None else {'''shortest_edge''': 3_0}
						snake_case__	:      int     		=	crop_size if crop_size is not None else {'''height''': 3_0, '''width''': 3_0}
						snake_case__	:      Dict     		=	parent
						snake_case__	:      List[str]     		=	batch_size
						snake_case__	:      Union[str, Any]     		=	num_channels
						snake_case__	:      str     		=	min_resolution
						snake_case__	:      Optional[int]     		=	max_resolution
						snake_case__	:      str     		=	do_resize_and_center_crop
						snake_case__	:      str     		=	size
						snake_case__	:      Optional[int]     		=	crop_pct
						snake_case__	:      Dict     		=	crop_size
						snake_case__	:      Dict     		=	do_normalize
						snake_case__	:      int     		=	image_mean
						snake_case__	:      Union[str, Any]     		=	image_std






		def 	__lowerCamelCase			(     self     :str  ):
						return {
						    "size": self.size,
						    "do_resize_and_center_crop": self.do_resize_and_center_crop,
						    "crop_pct": self.crop_pct,
						    "crop_size": self.crop_size,
						    "do_normalize": self.do_normalize,
						    "image_mean": self.image_mean,
						    "image_std": self.image_std,
						}


@require_torch
@require_vision
class       a							(			a_  ,							unittest.TestCase				):
		__lowerCAmelCase	:    List[str]											=					PoolFormerImageProcessor if is_vision_available() else None



		def 	__lowerCamelCase			(     self     :Tuple  ):
						snake_case__	:      Optional[Any]     		=	PoolFormerImageProcessingTester(self  )



		@property
		def 	__lowerCamelCase			(     self     :Tuple  ):
						return self.image_processor_tester.prepare_image_processor_dict()



		def 	__lowerCamelCase			(     self     :List[Any]  ):
						snake_case__	:      List[Any]     		=	self.image_processing_class(**self.image_processor_dict  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''do_resize_and_center_crop'''  )  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''size'''  )  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''crop_pct'''  )  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''do_normalize'''  )  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''image_mean'''  )  )
						self.assertTrue(hasattr(_lowerCamelCase   ,'''image_std'''  )  )



		def 	__lowerCamelCase			(     self     :Any  ):
						snake_case__	:      Optional[int]     		=	self.image_processing_class.from_dict(self.image_processor_dict  )
						self.assertEqual(image_processor.size   ,{'''shortest_edge''': 3_0}  )
						self.assertEqual(image_processor.crop_size   ,{'''height''': 3_0, '''width''': 3_0}  )

						snake_case__	:      List[str]     		=	self.image_processing_class.from_dict(self.image_processor_dict   ,size=4_2   ,crop_size=8_4  )
						self.assertEqual(image_processor.size   ,{'''shortest_edge''': 4_2}  )
						self.assertEqual(image_processor.crop_size   ,{'''height''': 8_4, '''width''': 8_4}  )



		def 	__lowerCamelCase			(     self     :List[str]  ):
						pass



		def 	__lowerCamelCase			(     self     :Dict  ):
						# Initialize image_processing
						snake_case__	:      Optional[int]     		=	self.image_processing_class(**self.image_processor_dict  )
						# create random PIL images
						snake_case__	:      List[Any]     		=	prepare_image_inputs(self.image_processor_tester   ,equal_resolution=_lowerCamelCase  )
						for image in image_inputs:
										self.assertIsInstance(_lowerCamelCase   ,Image.Image  )

						# Test not batched input
						snake_case__	:      int     		=	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
						snake_case__	:      int     		=	image_processing(_lowerCamelCase   ,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     :int  ):
						# Initialize image_processing
						snake_case__	:      Union[str, Any]     		=	self.image_processing_class(**self.image_processor_dict  )
						# create random numpy tensors
						snake_case__	:      Tuple     		=	prepare_image_inputs(self.image_processor_tester   ,equal_resolution=_lowerCamelCase   ,numpify=_lowerCamelCase  )
						for image in image_inputs:
										self.assertIsInstance(_lowerCamelCase   ,np.ndarray  )

						# Test not batched input
						snake_case__	:      Tuple     		=	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
						snake_case__	:      str     		=	image_processing(_lowerCamelCase   ,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     :List[Any]  ):
						# Initialize image_processing
						snake_case__	:      Optional[int]     		=	self.image_processing_class(**self.image_processor_dict  )
						# create random PyTorch tensors
						snake_case__	:      List[str]     		=	prepare_image_inputs(self.image_processor_tester   ,equal_resolution=_lowerCamelCase   ,torchify=_lowerCamelCase  )
						for image in image_inputs:
										self.assertIsInstance(_lowerCamelCase   ,torch.Tensor  )

						# Test not batched input
						snake_case__	:      Any     		=	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
						snake_case__	:      Optional[Any]     		=	image_processing(_lowerCamelCase   ,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'''],
						    )   ,)









"""simple docstring"""



import requests
from bsa import BeautifulSoup
def 						_SCREAMING_SNAKE_CASE (    __snake_case			:  str = "AAPL"    ):





  '''simple docstring'''





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


