


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__):


       """simple docstring"""




       A__   		=     "mock"





       def __init__(  self				:     str   , *__lowerCamelCase				:     Optional[int]   , __lowerCamelCase				:     int   , **__lowerCamelCase				:     str			):


             '''simple docstring'''



             super().__init__()
             lowerCamelCase__						:							Optional[Any]       =    LocalFileSystem(*__lowerCamelCase   , **__lowerCamelCase			)
             lowerCamelCase__						:							Tuple       =    Path(__lowerCamelCase			).resolve().as_posix() + "/"





       def 		lowerCAmelCase	(  self				:     Dict   , __lowerCamelCase				:     Optional[Any]   , *__lowerCamelCase				:     Union[str, Any]   , **__lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							Dict       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.mkdir(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     Optional[Any]   , __lowerCamelCase				:     List[str]   , *__lowerCamelCase				:     int   , **__lowerCamelCase				:     Tuple			):


             '''simple docstring'''



             lowerCamelCase__						:							int       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.makedirs(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     Union[str, Any]   , __lowerCamelCase				:     Tuple			):


             '''simple docstring'''



             lowerCamelCase__						:							str       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.rmdir(__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     str   , __lowerCamelCase				:     Union[str, Any]   , __lowerCamelCase				:     int=True   , *__lowerCamelCase				:     Tuple   , **__lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							str       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             lowerCamelCase__						:							List[str]       =    self._fs.ls(__lowerCamelCase   , detail=__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)
             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 		lowerCAmelCase	(  self				:     Optional[int]   , __lowerCamelCase				:     Optional[Any]   , *__lowerCamelCase				:     Any   , **__lowerCamelCase				:     Any			):


             '''simple docstring'''



             lowerCamelCase__						:							Optional[Any]       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             lowerCamelCase__						:							Optional[Any]       =    dict(self._fs.info(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)			)
             lowerCamelCase__						:							Union[str, Any]       =    out["name"][len(self.local_root_dir			) :]
             return out





       def 		lowerCAmelCase	(  self				:     Any   , __lowerCamelCase				:     List[Any]   , __lowerCamelCase				:     Union[str, Any]   , *__lowerCamelCase				:     int   , **__lowerCamelCase				:     List[str]			):


             '''simple docstring'''



             lowerCamelCase__						:							int       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             lowerCamelCase__						:							str       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.cp_file(__lowerCamelCase   , __lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     List[Any]   , __lowerCamelCase				:     Tuple   , *__lowerCamelCase				:     Union[str, Any]   , **__lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							Any       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.rm_file(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     List[str]   , __lowerCamelCase				:     Any   , *__lowerCamelCase				:     str   , **__lowerCamelCase				:     int			):


             '''simple docstring'''



             lowerCamelCase__						:							Optional[Any]       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.rm(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     Tuple   , __lowerCamelCase				:     Union[str, Any]   , *__lowerCamelCase				:     Optional[int]   , **__lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							Optional[Any]       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs._open(__lowerCamelCase   , *__lowerCamelCase   , **__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     Optional[Any]   , __lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							Tuple       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.created(__lowerCamelCase			)





       def 		lowerCAmelCase	(  self				:     Dict   , __lowerCamelCase				:     str			):


             '''simple docstring'''



             lowerCamelCase__						:							str       =    posixpath.join(self.local_root_dir   , self._strip_protocol(__lowerCamelCase			)			)
             return self._fs.modified(__lowerCamelCase			)





       @classmethod
       def 		lowerCAmelCase	(  cls				:     Union[str, Any]   , __lowerCamelCase				:     List[str]			):


             '''simple docstring'''



             lowerCamelCase__						:							Optional[Any]       =    stringify_path(__lowerCamelCase			)
             if path.startswith("mock://"			):
                   lowerCamelCase__						:							List[Any]       =    path[7:]
             return path







class      _lowercase					(				lowercase__):


       """simple docstring"""




       A__   		=     "tmp"
       A__   		=     None





       def __init__(  self				:     Any   , *__lowerCamelCase				:     List[Any]   , **__lowerCamelCase				:     List[Any]			):


             '''simple docstring'''



             assert self.tmp_dir is not None, "TmpDirFileSystem.tmp_dir is not set"
             super().__init__(*__lowerCamelCase   , **__lowerCamelCase   , local_root_dir=self.tmp_dir   , auto_mkdir=__lowerCamelCase			)





       @classmethod
       def 		lowerCAmelCase	(  cls				:     Optional[int]   , __lowerCamelCase				:     Optional[int]			):


             '''simple docstring'''



             lowerCamelCase__						:							Tuple       =    stringify_path(__lowerCamelCase			)
             if path.startswith("tmp://"			):
                   lowerCamelCase__						:							Optional[Any]       =    path[6:]
             return path



@pytest.fixture
def  lowercase_						(						):

      """simple docstring"""




      lowerCamelCase__						:							List[Any]       =    MockFileSystem
      lowerCamelCase__						:							List[str]       =    TmpDirFileSystem
      yield
      del _fsspec_registry["mock"]
      del _fsspec_registry["tmp"]

@pytest.fixture
def  lowercase_						(						_A     :       Tuple       ,   _A     :       List[Any]		):

      """simple docstring"""




      lowerCamelCase__						:							str       =    tmp_path_factory.mktemp("mockfs"		)
      return MockFileSystem(local_root_dir=_A       ,   auto_mkdir=_A		)


@pytest.fixture
def  lowercase_						(						_A     :       List[Any]       ,   _A     :       Union[str, Any]		):

      """simple docstring"""




      lowerCamelCase__						:							str       =    tmp_path_factory.mktemp("tmpfs"		)
      with patch.object(_A       ,   "tmp_dir"       ,   _A		):
            yield TmpDirFileSystem()






def  lowercase_						(						_A     :       int		):

      """simple docstring"""




      if not isinstance(_A       ,   _A		):
            raise ValueError("double_factorial() only accepts integral values"		)
      if num < 0:
            raise ValueError("double_factorial() not defined for negative values"		)
      lowerCamelCase__						:							Union[str, Any]       =    1
      for i in range(_A       ,   0       ,   -2		):
            value *= i
      return value


if __name__ == "__main__":
    import doctest

    doctest.testmod()


