




from collections import OrderedDict
from dataclasses import fields
from typing import Any, Tuple

import numpy as np

from .import_utils import is_torch_available


def 		_lowerCamelCase					(       UpperCamelCase				)      ->		List[str]:





  """simple docstring"""





  if is_torch_available():
    import torch

    if isinstance(UpperCamelCase       ,  torch.Tensor				):
      return True

  return isinstance(UpperCamelCase       ,  np.ndarray				)





class   UpperCAmelCase    (      A ):






   def 			_a    (						self :							Any  )->      str:
     _lowercase:			Tuple      =     fields(self  )

     # Safety and consistency checks
     if not len(UpperCamelCase_  ):
       raise ValueError(f'{self.__class__.__name__} has no fields.'  )

     _lowercase:			Any      =     getattr(self    ,       class_fields[0].name  )
     _lowercase:			int      =     all(getattr(self    ,       field.name  ) is None for field in class_fields[1:]  )

     if other_fields_are_none and isinstance(UpperCamelCase_    ,       UpperCamelCase_  ):
       for key, value in first_field.items():
         _lowercase:			Optional[int]      =     value
     else:
       for field in class_fields:
         _lowercase:			List[str]      =     getattr(self    ,       field.name  )
         if v is not None:
           _lowercase:			Union[str, Any]      =     v






   def __delitem__(						self :							List[str]    ,       *UpperCamelCase_ :							Optional[int]    ,       **UpperCamelCase_ :							Dict  )->      str:
     raise Exception(f'You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.'  )






   def 			_a    (						self :							Dict    ,       *UpperCamelCase_ :							List[str]    ,       **UpperCamelCase_ :							Dict  )->      Tuple:
     raise Exception(f'You cannot use ``setdefault`` on a {self.__class__.__name__} instance.'  )






   def 			_a    (						self :							Optional[int]    ,       *UpperCamelCase_ :							str    ,       **UpperCamelCase_ :							List[Any]  )->      str:
     raise Exception(f'You cannot use ``pop`` on a {self.__class__.__name__} instance.'  )






   def 			_a    (						self :							List[Any]    ,       *UpperCamelCase_ :							str    ,       **UpperCamelCase_ :							Optional[int]  )->      Tuple:
     raise Exception(f'You cannot use ``update`` on a {self.__class__.__name__} instance.'  )






   def __getitem__(						self :							Optional[Any]    ,       UpperCamelCase_ :							List[Any]  )->      Tuple:
     if isinstance(UpperCamelCase_    ,       UpperCamelCase_  ):
       _lowercase:			Optional[int]      =     dict(self.items()  )
       return inner_dict[k]
     else:
       return self.to_tuple()[k]






   def __setattr__(						self :							Optional[int]    ,       UpperCamelCase_ :							List[Any]    ,       UpperCamelCase_ :							Optional[int]  )->      Dict:
     if name in self.keys() and value is not None:
       # Don't call self.__setitem__ to avoid recursion errors
       super().__setitem__(UpperCamelCase_    ,       UpperCamelCase_  )
     super().__setattr__(UpperCamelCase_    ,       UpperCamelCase_  )






   def __setitem__(						self :							Tuple    ,       UpperCamelCase_ :							Optional[int]    ,       UpperCamelCase_ :							Any  )->      Union[str, Any]:
     # Will raise a KeyException if needed
     super().__setitem__(UpperCamelCase_    ,       UpperCamelCase_  )
     # Don't call self.__setattr__ to avoid recursion errors
     super().__setattr__(UpperCamelCase_    ,       UpperCamelCase_  )






   def 			_a    (						self :							Optional[Any]  )->      Tuple[Any]:
     return tuple(self[k] for k in self.keys()  )






def 		_lowerCamelCase					(       UpperCamelCase       ,  UpperCamelCase				)      ->		int:





  """simple docstring"""





  return (input_a, input_a).count(0				) % 2


def 		_lowerCamelCase					(       )      ->		None:





  """simple docstring"""





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