






'''simple docstring'''

from dataclasses import dataclass, field
from typing import Tuple

from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends
from .benchmark_args_utils import BenchmarkArguments


if is_torch_available():
     import torch

if is_torch_tpu_available(check_device=False):
     import torch_xla.core.xla_model as xm


SCREAMING_SNAKE_CASE__      =   logging.get_logger(__name__)






@dataclass
class 				a_						(			__a				):
  lowercase     		=      [
      '''no_inference''',
      '''no_cuda''',
      '''no_tpu''',
      '''no_speed''',
      '''no_memory''',
      '''no_env_print''',
      '''no_multi_process''',
  ]

  def __init__(      self			,		**_SCREAMING_SNAKE_CASE      )  ->      Union[str, Any]:



        """simple docstring"""






        for deprecated_arg in self.deprecated_args:
              if deprecated_arg in kwargs:
                    UpperCamelCase				  =					deprecated_arg[3:]
                    setattr(self			,		lowerCAmelCase__			,		not kwargs.pop(lowerCAmelCase__      )      )
                    logger.warning(
                        F"{deprecated_arg} is depreciated. Please use --no_{positive_arg} or"
                        F" {positive_arg}={kwargs[positive_arg]}"      )

        UpperCamelCase				  =					kwargs.pop("""torchscript"""			,		self.torchscript      )
        UpperCamelCase				  =					kwargs.pop("""torch_xla_tpu_print_metrics"""			,		self.torch_xla_tpu_print_metrics      )
        UpperCamelCase				  =					kwargs.pop("""fp16_opt_level"""			,		self.fpaa_opt_level      )
        super().__init__(**lowerCAmelCase__      )

  lowercase     		=      field(default=__a	,       metadata={"""help""": """Trace the models using torchscript"""}				)
  lowercase     		=      field(default=__a	,       metadata={"""help""": """Print Xla/PyTorch tpu metrics"""}				)
  lowercase     		=      field(
      default="""O1"""	,       metadata={
          """help""": (
              """For fp16: Apex AMP optimization level selected in [\'O0\', \'O1\', \'O2\', and \'O3\']. """
              """See details at https://nvidia.github.io/apex/amp.html"""
          )
      }	,       )

  @cached_property
  def   A__						(      self      )  ->      Any:



        """simple docstring"""






        requires_backends(self			,		["""torch"""]      )
        logger.info("""PyTorch: setting up devices"""      )
        if not self.cuda:
              UpperCamelCase				  =					torch.device("""cpu"""      )
              UpperCamelCase				  =					0
        elif is_torch_tpu_available():
              UpperCamelCase				  =					xm.xla_device()
              UpperCamelCase				  =					0
        else:
              UpperCamelCase				  =					torch.device("""cuda""" if torch.cuda.is_available() else """cpu"""      )
              UpperCamelCase				  =					torch.cuda.device_count()
        return device, n_gpu

  @property
  def   A__						(      self      )  ->      Dict:



        """simple docstring"""






        return is_torch_tpu_available() and self.tpu

  @property
  def   A__						(      self      )  ->      str:



        """simple docstring"""






        requires_backends(self			,		["""torch"""]      )
        # TODO(PVP): currently only single GPU is supported
        return torch.cuda.current_device()

  @property
  def   A__						(      self      )  ->      Dict:



        """simple docstring"""






        requires_backends(self			,		["""torch"""]      )
        return self._setup_devices[0]

  @property
  def   A__						(      self      )  ->      Optional[int]:



        """simple docstring"""






        requires_backends(self			,		["""torch"""]      )
        return self._setup_devices[1]


  @property
  def   A__						(      self      )  ->      Union[str, Any]:



        """simple docstring"""






        return self.n_gpu > 0


"""simple docstring"""





import requests
from bsa import BeautifulSoup



def 						_lowerCAmelCase				(				UpperCamelCase_ = "AAPL"				):
		__SCREAMING_SNAKE_CASE            = f"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}"
		__SCREAMING_SNAKE_CASE            = BeautifulSoup(requests.get(UpperCamelCase_				).text  ,				"""html.parser"""				)
		__SCREAMING_SNAKE_CASE            = """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}""")




