

import posixpath
from pathlib import Path
from unittest.mock import patch

import pytest
from fsspec.implementations.local import AbstractFileSystem, LocalFileSystem, stringify_path
from fsspec.registry import _registry as _fsspec_registry



class 						lowercase_					(						__lowercase  ):
      UpperCamelCase_    :	int		   =       "mock"



      def __init__(    self   :       Dict    ,      *A__   :       int    ,      A__   :       str    ,      **A__   :       str	)					->  Union[str, Any]:
        super().__init__()
        _snake_case		=							LocalFileSystem(*A__    ,      **A__	)
        _snake_case		=							Path(A__	).resolve().as_posix() + '''/'''



      def 		UpperCamelCase_	(    self   :       Union[str, Any]    ,      A__   :       Optional[int]    ,      *A__   :       Dict    ,      **A__   :       Dict	)					->  int:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.mkdir(A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       Optional[Any]    ,      A__   :       List[str]    ,      *A__   :       Union[str, Any]    ,      **A__   :       Dict	)					->  List[str]:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.makedirs(A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       List[Any]    ,      A__   :       List[str]	)					->  Dict:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.rmdir(A__	)



      def 		UpperCamelCase_	(    self   :       Optional[Any]    ,      A__   :       List[Any]    ,      A__   :       List[Any]=True    ,      *A__   :       Optional[Any]    ,      **A__   :       List[str]	)					->  int:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        _snake_case		=							self._fs.ls(A__    ,      detail=A__    ,      *A__    ,      **A__	)
        if detail:
          return [{**info, "name": info["name"][len(self.local_root_dir	) :]} for info in out]
        else:
          return [name[len(self.local_root_dir	) :] for name in out]



      def 		UpperCamelCase_	(    self   :       Union[str, Any]    ,      A__   :       Dict    ,      *A__   :       Dict    ,      **A__   :       List[Any]	)					->  Optional[Any]:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        _snake_case		=							dict(self._fs.info(A__    ,      *A__    ,      **A__	)	)
        _snake_case		=							out['''name'''][len(self.local_root_dir	) :]
        return out



      def 		UpperCamelCase_	(    self   :       Optional[Any]    ,      A__   :       List[Any]    ,      A__   :       Optional[Any]    ,      *A__   :       List[Any]    ,      **A__   :       Union[str, Any]	)					->  Union[str, Any]:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.cp_file(A__    ,      A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       Optional[Any]    ,      A__   :       Dict    ,      *A__   :       int    ,      **A__   :       List[Any]	)					->  str:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.rm_file(A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       List[str]    ,      A__   :       str    ,      *A__   :       List[Any]    ,      **A__   :       int	)					->  int:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.rm(A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       Optional[Any]    ,      A__   :       Any    ,      *A__   :       List[Any]    ,      **A__   :       List[Any]	)					->  str:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs._open(A__    ,      *A__    ,      **A__	)



      def 		UpperCamelCase_	(    self   :       int    ,      A__   :       Optional[Any]	)					->  List[Any]:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.created(A__	)



      def 		UpperCamelCase_	(    self   :       Any    ,      A__   :       Any	)					->  Any:
        _snake_case		=							posixpath.join(self.local_root_dir    ,      self._strip_protocol(A__	)	)
        return self._fs.modified(A__	)







      @classmethod
      def 		UpperCamelCase_	(    cls   :       Dict    ,      A__   :       Tuple	)					->  Union[str, Any]:
        _snake_case		=							stringify_path(A__	)
        if path.startswith('''mock://'''	):
          _snake_case		=							path[7:]
        return path



class 						lowercase_					(						__lowercase  ):
      UpperCamelCase_    :	str		   =       "tmp"
      UpperCamelCase_    :	Union[str, Any]		   =       None



      def __init__(    self   :       Any    ,      *A__   :       Optional[int]    ,      **A__   :       List[str]	)					->  Tuple:
        assert self.tmp_dir is not None, "TmpDirFileSystem.tmp_dir is not set"
        super().__init__(*A__    ,      **A__    ,      local_root_dir=self.tmp_dir    ,      auto_mkdir=A__	)







      @classmethod
      def 		UpperCamelCase_	(    cls   :       List[str]    ,      A__   :       Optional[Any]	)					->  Tuple:
        _snake_case		=							stringify_path(A__	)
        if path.startswith('''tmp://'''	):
          _snake_case		=							path[6:]
        return path



@pytest.fixture
def    snake_case_()							->			Any:



  """simple docstring"""






  _snake_case		=							MockFileSystem
  _snake_case		=							TmpDirFileSystem
  yield
  del _fsspec_registry["mock"]
  del _fsspec_registry["tmp"]



@pytest.fixture
def    snake_case_(_UpperCamelCase				, _UpperCamelCase  )							->			List[Any]:



  """simple docstring"""






  _snake_case		=							tmp_path_factory.mktemp('''mockfs'''  )
  return MockFileSystem(local_root_dir=_UpperCamelCase				, auto_mkdir=_UpperCamelCase  )



@pytest.fixture
def    snake_case_(_UpperCamelCase				, _UpperCamelCase  )							->			List[Any]:



  """simple docstring"""






  _snake_case		=							tmp_path_factory.mktemp('''tmpfs'''  )
  with patch.object(_UpperCamelCase				, '''tmp_dir'''				, _UpperCamelCase  ):
    yield TmpDirFileSystem()




from collections import namedtuple

__A    	=			namedtuple('''from_to''', '''from_ to''')

__A    	=			{
    '''atm''': from_to(1, 1),
    '''pascal''': from_to(0.000_0098, 10_13_25),
    '''bar''': from_to(0.98_6923, 1.0_1325),
    '''kilopascal''': from_to(0.0098_6923, 101.325),
    '''megapascal''': from_to(9.8_6923, 0.10_1325),
    '''psi''': from_to(0.06_8046, 14.6959),
    '''inHg''': from_to(0.033_4211, 29.9213),
    '''torr''': from_to(0.0013_1579, 7_60),
}



def    snake_case_(_UpperCamelCase				, _UpperCamelCase				, _UpperCamelCase  )							->			float:



  """simple docstring"""






  if from_type not in PRESSURE_CONVERSION:
    raise ValueError(
        F"""Invalid 'from_type' value: {from_type!r}  Supported values are:\n"""
        + ''', '''.join(_UpperCamelCase  )  )
  if to_type not in PRESSURE_CONVERSION:
    raise ValueError(
        F"""Invalid 'to_type' value: {to_type!r}.  Supported values are:\n"""
        + ''', '''.join(_UpperCamelCase  )  )
  return (
      value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
  )


if __name__ == "__main__":
 import doctest

 doctest.testmod()

