

'''simple docstring'''




import importlib.metadata
import subprocess
import sys


def  lowerCamelCase__						(  SCREAMING_SNAKE_CASE :				bool = False  ):
  UpperCAmelCase  							=		False
  if "IPython" in sys.modules:
    UpperCAmelCase  							=		'google.colab' in str(sys.modules['IPython'].get_ipython()  )

  if in_colab:
    if upgrade:
      UpperCAmelCase  							=		['pip', 'install', '-U', 'torch']
      subprocess.run(SCREAMING_SNAKE_CASE    ,				check=SCREAMING_SNAKE_CASE  )
    # get the current version of torch
    UpperCAmelCase  							=		importlib.metadata.version('torch'  )
    UpperCAmelCase  							=		torch_version[: torch_version.rindex('.'  )]
    UpperCAmelCase  							=		f'''https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'''
    UpperCAmelCase  							=		['pip', 'install', xla_wheel]
    subprocess.run(SCREAMING_SNAKE_CASE    ,				check=SCREAMING_SNAKE_CASE  )
  else:
    raise RuntimeError('`install_xla` utility works only on google colab.'  )





'''simple docstring'''




from collections import namedtuple

_a			:	int								=  namedtuple('from_to', 'from_ to')

_a			:	Dict								=  {
    'atm': from_to(1, 1),
    'pascal': from_to(0.0000098, 101_325),
    'bar': from_to(0.986923, 1.01325),
    'kilopascal': from_to(0.00986923, 101.325),
    'megapascal': from_to(9.86923, 0.101325),
    'psi': from_to(0.068046, 14.6959),
    'inHg': from_to(0.0334211, 29.9213),
    'torr': from_to(0.00131579, 760),
}


def  lowerCamelCase__						(  SCREAMING_SNAKE_CASE :				float    ,				SCREAMING_SNAKE_CASE :				str    ,				SCREAMING_SNAKE_CASE :				str  ):
  if from_type not in PRESSURE_CONVERSION:
    raise ValueError(
        f'''Invalid \'from_type\' value: {from_type!r}  Supported values are:\n'''
        + ', '.join(SCREAMING_SNAKE_CASE  )  )
  if to_type not in PRESSURE_CONVERSION:
    raise ValueError(
        f'''Invalid \'to_type\' value: {to_type!r}.  Supported values are:\n'''
        + ', '.join(SCREAMING_SNAKE_CASE  )  )
  return (
      value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
  )


if __name__ == "__main__":
  import doctest

  doctest.testmod()


