





"""simple docstring"""
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 			a       (      a__     ):
 snake_case__								=					'''mock'''



 def __init__(    self							,					*_snake_case							,					_snake_case							,					**_snake_case    ):







  """simple docstring"""






  super().__init__()
  lowerCAmelCase													=   LocalFileSystem(*_snake_case							,					**_snake_case    )
  lowerCAmelCase													=   Path(_snake_case    ).resolve().as_posix() + '/'



 def       UpperCamelCase__     (    self							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.mkdir(_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.makedirs(_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.rmdir(_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case							,					_snake_case=True							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  lowerCAmelCase													=   self._fs.ls(_snake_case							,					detail=_snake_case							,					*_snake_case							,					**_snake_case    )
  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							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  lowerCAmelCase													=   dict(self._fs.info(_snake_case							,					*_snake_case							,					**_snake_case    )    )
  lowerCAmelCase													=   out['name'][len(self.local_root_dir    ) :]
  return out



 def       UpperCamelCase__     (    self							,					_snake_case							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.cp_file(_snake_case							,					_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.rm_file(_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.rm(_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs._open(_snake_case							,					*_snake_case							,					**_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.created(_snake_case    )



 def       UpperCamelCase__     (    self							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   posixpath.join(self.local_root_dir							,					self._strip_protocol(_snake_case    )    )
  return self._fs.modified(_snake_case    )



 @classmethod
 def       UpperCamelCase__     (    cls							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   stringify_path(_snake_case    )
  if path.startswith('mock://'    ):
   lowerCAmelCase													=   path[7:]
  return path







class 			a       (      a__     ):
 snake_case__								=					'''tmp'''
 snake_case__								=					None



 def __init__(    self							,					*_snake_case							,					**_snake_case    ):







  """simple docstring"""






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



 @classmethod
 def       UpperCamelCase__     (    cls							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   stringify_path(_snake_case    )
  if path.startswith('tmp://'    ):
   lowerCAmelCase													=   path[6:]
  return path


@pytest.fixture
def 		_SCREAMING_SNAKE_CASE ():
 lowerCAmelCase													=   MockFileSystem
 lowerCAmelCase													=   TmpDirFileSystem
 yield
 del _fsspec_registry["mock"]
 del _fsspec_registry["tmp"]

@pytest.fixture
def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						Dict     ,    _UpperCAmelCase				:						Any ):
 lowerCAmelCase													=   tmp_path_factory.mktemp('mockfs' )
 return MockFileSystem(local_root_dir=_UpperCAmelCase     ,    auto_mkdir=_UpperCAmelCase )




@pytest.fixture
def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						Optional[int]     ,    _UpperCAmelCase				:						Dict ):
 lowerCAmelCase													=   tmp_path_factory.mktemp('tmpfs' )
 with patch.object(_UpperCAmelCase     ,    'tmp_dir'     ,    _UpperCAmelCase ):
  yield TmpDirFileSystem()












"""simple docstring"""
def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						int     ,    _UpperCAmelCase				:						int ):
 return (input_a, input_a).count(0 ) % 2

def 		_SCREAMING_SNAKE_CASE ():
 assert xor_gate(0     ,    0 ) == 0
 assert xor_gate(0     ,    1 ) == 1
 assert xor_gate(1     ,    0 ) == 1
 assert xor_gate(1     ,    1 ) == 0


if __name__ == "__main__":
       print(xor_gate(0, 0))
       print(xor_gate(0, 1))





