


import os
from typing import Optional

import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Dict    = ""
   a_				:							str    = (
       None  # protocol passed in prefix to the url. ex: "gzip", for gzip://file.txt::http://foo.bar/file.txt.gz
   )
   a_				:							str    = None  # compression type in fsspec. ex: "gzip"
   a_				:							str    = None  # extension of the filename to strip. ex: "".gz" to get file.txt from file.txt.gz

   def __init__(  self  : Optional[int]       ,  _lowerCamelCase  : str = ""       ,  _lowerCamelCase  : Optional[str] = None       ,  _lowerCamelCase  : Optional[dict] = None       ,  **_lowerCamelCase  : Optional[Any]							):






         '''simple docstring'''



         super().__init__(self       ,  **_lowerCamelCase							)
         # always open as "rb" since fsspec can then use the TextIOWrapper to make it work for "r" mode
         __lowerCamelCase     :      List[Any]       						=						fsspec.open(
             _lowerCamelCase       ,  mode="""rb"""       ,  protocol=_lowerCamelCase       ,  compression=self.compression       ,  client_kwargs={
                 """requote_redirect_url""": False,  # see https://github.com/huggingface/datasets/pull/5459
                 """trust_env""": True,  # Enable reading proxy env variables.
                 **(target_options or {}).pop("""client_kwargs"""       ,  {}							),  # To avoid issues if it was already passed.
             }       ,  **(target_options or {})       ,  )
         __lowerCamelCase     :      Union[str, Any]       						=						os.path.basename(self.file.path.split("""::"""							)[0]							)
         __lowerCamelCase     :      int       						=						(
             self.compressed_name[: self.compressed_name.rindex("""."""							)]
             if """.""" in self.compressed_name
             else self.compressed_name
         )
         __lowerCamelCase     :      Dict       						=						None

   @classmethod
   def   _snake_case    (  cls  : List[str]       ,  _lowerCamelCase  : Union[str, Any]							):






         '''simple docstring'''



         return super()._strip_protocol(_lowerCamelCase							).lstrip("""/"""							)

   def   _snake_case    (  self  : Optional[Any]							):






         '''simple docstring'''



         if self.dir_cache is None:
               __lowerCamelCase     :      Dict       						=						{**self.file.fs.info(self.file.path							), """name""": self.uncompressed_name}
               __lowerCamelCase     :      Optional[int]       						=						{f["""name"""]: f}

   def   _snake_case    (  self  : Tuple       ,  _lowerCamelCase  : str							):






         '''simple docstring'''



         return self.file.open().read()


   def   _snake_case    (  self  : Any       ,  _lowerCamelCase  : str       ,  _lowerCamelCase  : str = "rb"       ,  _lowerCamelCase  : int=None       ,  _lowerCamelCase  : Any=True       ,  _lowerCamelCase  : Tuple=None       ,  **_lowerCamelCase  : Optional[Any]       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Any       						=						self._strip_protocol(_lowerCamelCase							)
         if mode != "rb":
               raise ValueError(F"""Tried to read with mode {mode} on file {self.file.path} opened with mode 'rb'"""							)
         return self.file.open()



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Union[str, Any]    = "bz2"
   a_				:							int    = "bz2"
   a_				:							List[Any]    = ".bz2"



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							str    = "gzip"
   a_				:							Dict    = "gzip"
   a_				:							Optional[int]    = ".gz"



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Union[str, Any]    = "lz4"
   a_				:							str    = "lz4"
   a_				:							List[Any]    = ".lz4"



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Optional[Any]    = "xz"
   a_				:							str    = "xz"
   a_				:							Union[str, Any]    = ".xz"



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Optional[int]    = "zstd"
   a_				:							Dict    = "zstd"
   a_				:							int    = ".zst"

   def __init__(  self  : Tuple       ,  _lowerCamelCase  : str       ,  _lowerCamelCase  : str = "rb"       ,  _lowerCamelCase  : Optional[str] = None       ,  _lowerCamelCase  : Optional[dict] = None       ,  _lowerCamelCase  : int = DEFAULT_BLOCK_SIZE       ,  **_lowerCamelCase  : List[str]       ,  ):






         '''simple docstring'''



         super().__init__(
             fo=_lowerCamelCase       ,  mode=_lowerCamelCase       ,  target_protocol=_lowerCamelCase       ,  target_options=_lowerCamelCase       ,  block_size=_lowerCamelCase       ,  **_lowerCamelCase       ,  )
         # We need to wrap the zstd decompressor to avoid this error in fsspec==2021.7.0 and zstandard==0.15.2:
         #
         # File "/Users/user/.virtualenvs/hf-datasets/lib/python3.7/site-packages/fsspec/core.py", line 145, in open
         #     out.close = close
         # AttributeError: 'zstd.ZstdDecompressionReader' object attribute 'close' is read-only
         #
         # see https://github.com/intake/filesystem_spec/issues/725
         __lowerCamelCase     :      List[Any]       						=						self.file.__enter__



         class 							_UpperCamelCase :

            '''simple docstring'''







            def __init__(  self  : List[Any]       ,  _lowerCamelCase  : Optional[int]							):






                  '''simple docstring'''



                  __lowerCamelCase     :      Union[str, Any]       						=						file_

            def __enter__(  self  : Any							):






                  '''simple docstring'''



                  self._file.__enter__()
                  return self

            def __exit__(  self  : Optional[Any]       ,  *_lowerCamelCase  : int       ,  **_lowerCamelCase  : Dict							):






                  '''simple docstring'''



                  self._file.__exit__(*_lowerCamelCase       ,  **_lowerCamelCase							)

            def __iter__(  self  : List[Any]							):






                  '''simple docstring'''



                  return iter(self._file							)

            def   _snake_case    (  self  : Tuple							):






                  '''simple docstring'''



                  return next(self._file							)


            def __getattr__(  self  : Optional[Any]       ,  _lowerCamelCase  : Dict							):






                  '''simple docstring'''



                  return getattr(self._file       ,  _lowerCamelCase							)

         def fixed_enter(*_lowerCamelCase  : Tuple       ,  **_lowerCamelCase  : str							):
               return WrappedFile(_enter(*_lowerCamelCase       ,  **_lowerCamelCase							)							)

         __lowerCamelCase     :      Any       						=						fixed_enter







import qiskit





def   _UpperCAmelCase       (     UpperCAmelCase      :			int						,	UpperCAmelCase      :			int      ):
      """simple docstring"""




      __lowerCamelCase     :      Dict       						=						qiskit.Aer.get_backend("""aer_simulator"""      )

      __lowerCamelCase     :      Dict       						=						qiskit.QuantumCircuit(4						,	2      )
      # encode inputs in qubits 0 and 1
      if bita == 1:
            qc_ha.x(0      )
      if bita == 1:
            qc_ha.x(1      )
      qc_ha.barrier()

      # use cnots to write XOR of the inputs on qubit2
      qc_ha.cx(0						,	2      )
      qc_ha.cx(1						,	2      )

      # use ccx / toffoli gate to write AND of the inputs on qubit3
      qc_ha.ccx(0						,	1						,	3      )
      qc_ha.barrier()

      # extract outputs
      qc_ha.measure(2						,	0      )  # extract XOR value
      qc_ha.measure(3						,	1      )  # extract AND value

      # Execute the circuit on the qasm simulator
      __lowerCamelCase     :      str       						=						qiskit.execute(UpperCAmelCase						,	UpperCAmelCase						,	shots=1_000      )

      # Return the histogram data of the results of the experiment
      return job.result().get_counts(UpperCAmelCase      )


if __name__ == "__main__":
    __UpperCamelCase    :						List[str]     =							half_adder(1, 1)
    print(F'''Half Adder Output Qubit Counts: {counts}''')



