






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 				_lowerCAmelCase(       _UpperCamelCase					):





       """simple docstring"""







       a				:		int									='''mock'''





       def __init__(					self  ,			*_lowerCamelCase  ,			_lowerCamelCase  ,			**_lowerCamelCase							):
         super().__init__()
         UpperCamelCase_:					List[Any]          =				LocalFileSystem(*__a  ,			**__a							)
         UpperCamelCase_:					Optional[Any]          =				Path(__a							).resolve().as_posix() + '/'





       def 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Union[str, Any]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.mkdir(__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Tuple          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.makedirs(__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase							):
         UpperCamelCase_:					List[str]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.rmdir(__a							)





       def 			_a    (					self  ,			_lowerCamelCase  ,			_lowerCamelCase=True  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					str          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         UpperCamelCase_:					Union[str, Any]          =				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 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Tuple          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         UpperCamelCase_:					List[str]          =				dict(self._fs.info(__a  ,			*__a  ,			**__a							)							)
         UpperCamelCase_:					Tuple          =				out['name'][len(self.local_root_dir							) :]
         return out





       def 			_a    (					self  ,			_lowerCamelCase  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Optional[int]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         UpperCamelCase_:					List[str]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.cp_file(__a  ,			__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Any          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.rm_file(__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					List[Any]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.rm(__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         UpperCamelCase_:					Optional[int]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs._open(__a  ,			*__a  ,			**__a							)





       def 			_a    (					self  ,			_lowerCamelCase							):
         UpperCamelCase_:					Union[str, Any]          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.created(__a							)





       def 			_a    (					self  ,			_lowerCamelCase							):
         UpperCamelCase_:					str          =				posixpath.join(self.local_root_dir  ,			self._strip_protocol(__a							)							)
         return self._fs.modified(__a							)





       @classmethod
       def 			_a    (					cls  ,			_lowerCamelCase							):
         UpperCamelCase_:					Any          =				stringify_path(__a							)
         if path.startswith('mock://'							):
           UpperCamelCase_:					List[Any]          =				path[7:]
         return path







class 				_lowerCAmelCase(       _UpperCamelCase					):





       """simple docstring"""







       a				:		Dict									='''tmp'''
       a				:		str									=None





       def __init__(					self  ,			*_lowerCamelCase  ,			**_lowerCamelCase							):
         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 			_a    (					cls  ,			_lowerCamelCase							):
         UpperCamelCase_:					Tuple          =				stringify_path(__a							)
         if path.startswith('tmp://'							):
           UpperCamelCase_:					str          =				path[6:]
         return path







@pytest.fixture
def   snake_case					()       ->				List[Any]:
  UpperCamelCase_:					List[str]          =				MockFileSystem
  UpperCamelCase_:					Dict          =				TmpDirFileSystem
  yield
  del _fsspec_registry["mock"]
  del _fsspec_registry["tmp"]

@pytest.fixture
def   snake_case					(UpperCAmelCase__	,    UpperCAmelCase__  )       ->				str:
  UpperCamelCase_:					Optional[int]          =				tmp_path_factory.mktemp('mockfs'  )
  return MockFileSystem(local_root_dir=snake_case__	,    auto_mkdir=snake_case__  )

@pytest.fixture
def   snake_case					(UpperCAmelCase__	,    UpperCAmelCase__  )       ->				Dict:
  UpperCamelCase_:					Any          =				tmp_path_factory.mktemp('tmpfs'  )
  with patch.object(snake_case__	,    'tmp_dir'	,    snake_case__  ):
    yield TmpDirFileSystem()


def 						UpperCamelCase_(			snake_case__:  list   )       -> list:
 UpperCAmelCase__							=				len(snake_case__   )

 # Set the gap value to be decreased by a factor of 1.3
 # after each iteration
 UpperCAmelCase__							=				1.3

 # Continue sorting until the gap is 1
 while gap > 1:
  # Decrease the gap value
  UpperCAmelCase__							=				int(gap / shrink   )

  # Sort the elements using insertion sort
  for i in range(snake_case__  ,    len(snake_case__   )   ):
   UpperCAmelCase__							=				collection[i]
   UpperCAmelCase__							=				i
   while j >= gap and collection[j - gap] > temp:
    UpperCAmelCase__							=				collection[j - gap]
    j -= gap
   UpperCAmelCase__							=				temp

 return collection


if __name__ == "__main__":
 import doctest

 doctest.testmod()



