



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 						UpperCAmelCase__   (   UpperCAmelCase__			:Tuple       ):






 '''simple docstring'''

 if is_torch_available():
  import torch

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

 return isinstance(UpperCAmelCase__			,       np.ndarray       )




class 		_lowercase		(							UpperCAmelCase__						):

   def 		A				(   self      :							List[Any]				)							->					Tuple:


    """simple docstring"""






    a							=		fields(self				)

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

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

    if other_fields_are_none and isinstance(__lowerCAmelCase				, __lowerCAmelCase				):
     for key, value in first_field.items():
      a							=		value
    else:
     for field in class_fields:
      a							=		getattr(self				, field.name				)
      if v is not None:
       a							=		v

   def __delitem__(   self      :							str				, *__lowerCAmelCase      :							int				, **__lowerCAmelCase      :							List[Any]				)							->					List[str]:


    """simple docstring"""






    raise Exception(f"""You cannot use ``__delitem__`` on a {self.__class__.__name__} instance."""				)

   def 		A				(   self      :							Tuple				, *__lowerCAmelCase      :							Union[str, Any]				, **__lowerCAmelCase      :							Union[str, Any]				)							->					Any:


    """simple docstring"""






    raise Exception(f"""You cannot use ``setdefault`` on a {self.__class__.__name__} instance."""				)

   def 		A				(   self      :							Any				, *__lowerCAmelCase      :							Union[str, Any]				, **__lowerCAmelCase      :							Any				)							->					int:


    """simple docstring"""






    raise Exception(f"""You cannot use ``pop`` on a {self.__class__.__name__} instance."""				)

   def 		A				(   self      :							List[Any]				, *__lowerCAmelCase      :							Optional[Any]				, **__lowerCAmelCase      :							int				)							->					List[Any]:


    """simple docstring"""






    raise Exception(f"""You cannot use ``update`` on a {self.__class__.__name__} instance."""				)

   def __getitem__(   self      :							str				, __lowerCAmelCase      :							Tuple				)							->					Tuple:


    """simple docstring"""






    if isinstance(__lowerCAmelCase				, __lowerCAmelCase				):
     a							=		dict(self.items()				)
     return inner_dict[k]
    else:
     return self.to_tuple()[k]

   def __setattr__(   self      :							Dict				, __lowerCAmelCase      :							Optional[Any]				, __lowerCAmelCase      :							str				)							->					Optional[int]:


    """simple docstring"""






    if name in self.keys() and value is not None:
     # Don't call self.__setitem__ to avoid recursion errors
     super().__setitem__(__lowerCAmelCase				, __lowerCAmelCase				)
    super().__setattr__(__lowerCAmelCase				, __lowerCAmelCase				)

   def __setitem__(   self      :							List[Any]				, __lowerCAmelCase      :							Any				, __lowerCAmelCase      :							List[Any]				)							->					str:


    """simple docstring"""






    super().__setitem__(__lowerCAmelCase				, __lowerCAmelCase				)
    # Don't call self.__setattr__ to avoid recursion errors
    super().__setattr__(__lowerCAmelCase				, __lowerCAmelCase				)




   def 		A				(   self      :							Dict				)							->					Tuple[Any]:


    """simple docstring"""






    return tuple(self[k] for k in self.keys()				)







from math import sqrt


def 		_lowerCamelCase					(       UpperCamelCase				)      ->		list[int]:





  """simple docstring"""





  _lowercase:			Dict      =     [1]
  for i in range(2       ,  int(sqrt(UpperCamelCase				)				) + 1       ,  1				):
    if number % i == 0:
      values.append(UpperCamelCase				)
      if int(number // i				) != i:
        values.append(int(number // i				)				)
  return sorted(UpperCamelCase				)


def 		_lowerCamelCase					(       UpperCamelCase				)      ->		bool:





  """simple docstring"""





  return sum(factors(UpperCamelCase				)				) > n


def 		_lowerCamelCase					(       UpperCamelCase				)      ->		bool:





  """simple docstring"""





  _lowercase:			Dict      =     factors(UpperCamelCase				)
  _lowercase:			int      =     len(UpperCamelCase				)
  _lowercase:			Optional[int]      =     [[0 for i in range(number + 1				)] for j in range(r + 1				)]
  for i in range(r + 1				):
    _lowercase:			List[Any]      =     True

  for i in range(1       ,  number + 1				):
    _lowercase:			Optional[int]      =     False

  for i in range(1       ,  r + 1				):
    for j in range(1       ,  number + 1				):
      if j < values[i - 1]:
        _lowercase:			Optional[int]      =     subset[i - 1][j]
      else:
        _lowercase:			Optional[Any]      =     subset[i - 1][j] or subset[i - 1][j - values[i - 1]]

  return subset[r][number] != 0


def 		_lowerCamelCase					(       UpperCamelCase				)      ->		bool:





  """simple docstring"""





  return abundant(UpperCamelCase				) and not semi_perfect(UpperCamelCase				)


if __name__ == "__main__":
   import doctest

   doctest.testmod(verbose=True)
   for number in (69, 70, 71):
      print(f'''{number} is {'' if weird(number) else 'not '}weird.''')
