code: 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 					UpperCamelCase	(     snake_case__      ):
  					__UpperCamelCase						=   """mock"""
  
  
  
  
  					def __init__( self :					List[Any]      ,*_lowerCAmelCase :					Optional[int]      ,_lowerCAmelCase :					Union[str, Any]      ,**_lowerCAmelCase :					Union[str, Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							super().__init__()
  							__snake_case		       =     LocalFileSystem(*_lowerCAmelCase      ,**_lowerCAmelCase						)
  							__snake_case		       =     Path(_lowerCAmelCase						).resolve().as_posix() + "/"
  
  
  
  
  					def 							UpperCamelCase_						( self :					List[Any]      ,_lowerCAmelCase :					Optional[Any]      ,*_lowerCAmelCase :					Union[str, Any]      ,**_lowerCAmelCase :					Dict						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.mkdir(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					int      ,_lowerCAmelCase :					Tuple      ,*_lowerCAmelCase :					Optional[Any]      ,**_lowerCAmelCase :					Optional[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.makedirs(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Tuple      ,_lowerCAmelCase :					Any						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.rmdir(_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					List[Any]      ,_lowerCAmelCase :					List[Any]      ,_lowerCAmelCase :					str=True      ,*_lowerCAmelCase :					int      ,**_lowerCAmelCase :					List[str]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							__snake_case		       =     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 							UpperCamelCase_						( self :					List[str]      ,_lowerCAmelCase :					Any      ,*_lowerCAmelCase :					Any      ,**_lowerCAmelCase :					str						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							__snake_case		       =     dict(self._fs.info(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)						)
  							__snake_case		       =     out["name"][len(self.local_root_dir						) :]
  							return out
  
  
  
  
  					def 							UpperCamelCase_						( self :					Tuple      ,_lowerCAmelCase :					Optional[int]      ,_lowerCAmelCase :					Optional[Any]      ,*_lowerCAmelCase :					int      ,**_lowerCAmelCase :					Optional[int]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.cp_file(_lowerCAmelCase      ,_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Union[str, Any]      ,_lowerCAmelCase :					int      ,*_lowerCAmelCase :					List[Any]      ,**_lowerCAmelCase :					int						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.rm_file(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Optional[Any]      ,_lowerCAmelCase :					str      ,*_lowerCAmelCase :					Optional[int]      ,**_lowerCAmelCase :					int						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.rm(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					int      ,_lowerCAmelCase :					Optional[int]      ,*_lowerCAmelCase :					str      ,**_lowerCAmelCase :					Optional[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs._open(_lowerCAmelCase      ,*_lowerCAmelCase      ,**_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Union[str, Any]      ,_lowerCAmelCase :					Tuple						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.created(_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Union[str, Any]      ,_lowerCAmelCase :					int						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     posixpath.join(self.local_root_dir      ,self._strip_protocol(_lowerCAmelCase						)						)
  							return self._fs.modified(_lowerCAmelCase						)
  
  
  
  
  
  
  
  					@classmethod
  					def 							UpperCamelCase_						( cls :					Dict      ,_lowerCAmelCase :					Dict						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     stringify_path(_lowerCAmelCase						)
  							if path.startswith("mock://"						):
  									__snake_case		       =     path[7:]
  							return path
  
  
  
  
  class 					UpperCamelCase	(     snake_case__      ):
  					__UpperCamelCase						=   """tmp"""
  					__UpperCamelCase						=   None
  
  
  
  
  					def __init__( self :					int      ,*_lowerCAmelCase :					Tuple      ,**_lowerCAmelCase :					Union[str, 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 							UpperCamelCase_						( cls :					int      ,_lowerCAmelCase :					str						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     stringify_path(_lowerCAmelCase						)
  							if path.startswith("tmp://"						):
  									__snake_case		       =     path[6:]
  							return path
  
  
  
  
  @pytest.fixture
  def 							_lowerCamelCase(				)  ->   str:
  		__snake_case		       =     MockFileSystem
  		__snake_case		       =     TmpDirFileSystem
  		yield
  		del _fsspec_registry["mock"]
  		del _fsspec_registry["tmp"]
  
  
  
  @pytest.fixture
  def 							_lowerCamelCase(				__snake_case						,						__snake_case	)  ->   Dict:
  		__snake_case		       =     tmp_path_factory.mktemp("mockfs"	)
  		return MockFileSystem(local_root_dir=__snake_case						,						auto_mkdir=__snake_case	)
  
  
  
  
  
  @pytest.fixture
  def 							_lowerCamelCase(				__snake_case						,						__snake_case	)  ->   List[Any]:
  		__snake_case		       =     tmp_path_factory.mktemp("tmpfs"	)
  		with patch.object(__snake_case						,						"tmp_dir"						,						__snake_case	):
  				yield TmpDirFileSystem()
  
  
  
  
  
  
style_context: from __future__ import annotations
  
  from collections.abc import Iterable
  from dataclasses import dataclass
  from typing import Any
  
  
  
  
  class 					UpperCamelCase	:
  					__UpperCamelCase						=   ("""_front""", """_back""", """_len""")
  
  
  
  
  					@dataclass
  					class 					UpperCamelCase	:
  										__UpperCamelCase						=   None
  										__UpperCamelCase						=   None
  										__UpperCamelCase						=   None
  
  
  
  
  					class 					UpperCamelCase	:
  										__UpperCamelCase						=   ("""_cur""",)
  
  
  
  
  										def __init__( self :					Dict      ,_lowerCAmelCase :					Deque._Node | None						):
  
  
  												"""simple docstring"""
  
  
  
  
  												__snake_case		       =     cur
  
  
  
  
  										def __iter__( self :					Dict						):
  
  
  												"""simple docstring"""
  
  
  
  
  												return self
  
  
  
  
  
  
  
  										def 							UpperCamelCase_						( self :					Optional[Any]						):
  
  
  												"""simple docstring"""
  
  
  
  
  												if self._cur is None:
  														# finished iterating
  														raise StopIteration
  												__snake_case		       =     self._cur.val
  												__snake_case		       =     self._cur.next_node
  
  												return val
  
  
  
  
  					def __init__( self :					Optional[int]      ,_lowerCAmelCase :					Iterable[Any] | None = None						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     None
  							__snake_case		       =     None
  							__snake_case		       =     0
  
  							if iterable is not None:
  									# append every value to the deque
  									for val in iterable:
  											self.append(_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					int      ,_lowerCAmelCase :					Any						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     self._Node(_lowerCAmelCase      ,_lowerCAmelCase      ,_lowerCAmelCase						)
  							if self.is_empty():
  									# front = back
  									__snake_case		       =     __snake_case		       =     node
  									__snake_case		       =     1
  							else:
  									# connect nodes
  									__snake_case		       =     node
  									__snake_case		       =     self._back
  									__snake_case		       =     node  # assign new back to the new node
  
  									self._len += 1
  
  									# make sure there were no errors
  									assert not self.is_empty(), "Error on appending value."
  
  
  
  
  					def 							UpperCamelCase_						( self :					Any      ,_lowerCAmelCase :					Any						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     self._Node(_lowerCAmelCase      ,_lowerCAmelCase      ,_lowerCAmelCase						)
  							if self.is_empty():
  									# front = back
  									__snake_case		       =     __snake_case		       =     node
  									__snake_case		       =     1
  							else:
  									# connect nodes
  									__snake_case		       =     self._front
  									__snake_case		       =     node
  									__snake_case		       =     node  # assign new front to the new node
  
  									self._len += 1
  
  									# make sure there were no errors
  									assert not self.is_empty(), "Error on appending value."
  
  
  
  
  					def 							UpperCamelCase_						( self :					int      ,_lowerCAmelCase :					Iterable[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							for val in iterable:
  									self.append(_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					Optional[int]      ,_lowerCAmelCase :					Iterable[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							for val in iterable:
  									self.appendleft(_lowerCAmelCase						)
  
  
  
  
  					def 							UpperCamelCase_						( self :					List[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							assert not self.is_empty(), "Deque is empty."
  
  							__snake_case		       =     self._back
  							__snake_case		       =     self._back.prev_node  # set new back
  							# drop the last node - python will deallocate memory automatically
  							__snake_case		       =     None
  
  							self._len -= 1
  
  							return topop.val
  
  
  
  
  					def 							UpperCamelCase_						( self :					List[str]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							assert not self.is_empty(), "Deque is empty."
  
  							__snake_case		       =     self._front
  							__snake_case		       =     self._front.next_node  # set new front and drop the first node
  							__snake_case		       =     None
  
  							self._len -= 1
  
  							return topop.val
  
  
  
  
  					def 							UpperCamelCase_						( self :					int						):
  
  
  							"""simple docstring"""
  
  
  
  
  							return self._front is None
  
  
  
  
  					def __len__( self :					Tuple						):
  
  
  							"""simple docstring"""
  
  
  
  
  							return self._len
  
  
  
  
  					def __eq__( self :					Union[str, Any]      ,_lowerCAmelCase :					object						):
  
  
  							"""simple docstring"""
  
  
  
  
  							if not isinstance(_lowerCAmelCase      ,_lowerCAmelCase						):
  									return NotImplemented
  
  							__snake_case		       =     self._front
  							__snake_case		       =     other._front
  
  							# if the length of the dequeues are not the same, they are not equal
  							if len(self						) != len(_lowerCAmelCase						):
  									return False
  
  							while me is not None and oth is not None:
  									# compare every value
  									if me.val != oth.val:
  											return False
  									__snake_case		       =     me.next_node
  									__snake_case		       =     oth.next_node
  
  							return True
  
  
  
  
  					def __iter__( self :					Tuple						):
  
  
  							"""simple docstring"""
  
  
  
  
  							return Deque._Iterator(self._front						)
  
  
  
  
  
  
  
  					def __repr__( self :					List[Any]						):
  
  
  							"""simple docstring"""
  
  
  
  
  							__snake_case		       =     []
  							__snake_case		       =     self._front
  							while aux is not None:
  									# append the values in a list to display
  									values_list.append(aux.val						)
  									__snake_case		       =     aux.next_node
  
  							return F"""[{", ".join(repr(_lowerCAmelCase						) for val in values_list						)}]"""
  
  
  if __name__ == "__main__":
  		import doctest
  
  		doctest.testmod()
  
  
  
  
  
  