code: def _infer_unaryop(self, context=None):
      
      for operand in self.operand.infer(context):
          try:
              yield operand.infer_unary_op(self.op)
          except TypeError as exc:
              # The operand doesn't support this operation.
              yield util.BadUnaryOperationMessage(operand, self.op, exc)
          except AttributeError as exc:
              meth = protocols.UNARY_OP_METHOD[self.op]
              if meth is None:
                  # `not node`. Determine node's boolean
                  # value and negate its result, unless it is
                  # Uninferable, which will be returned as is.
                  bool_value = operand.bool_value()
                  if bool_value is not util.Uninferable:
                      yield nodes.const_factory(not bool_value)
                  else:
                      yield util.Uninferable
              else:
                  if not isinstance(operand, (bases.Instance, nodes.ClassDef)):
                      # The operation was used on something which
                      # doesn't support it.
                      yield util.BadUnaryOperationMessage(operand, self.op, exc)
                      continue
  
                  try:
                      try:
                          methods = dunder_lookup.lookup(operand, meth)
                      except exceptions.AttributeInferenceError:
                          yield util.BadUnaryOperationMessage(operand, self.op, exc)
                          continue
  
                      meth = methods[0]
                      inferred = next(meth.infer(context=context))
                      if inferred is util.Uninferable or not inferred.callable():
                          continue
  
                      context = contextmod.copy_context(context)
                      context.callcontext = contextmod.CallContext(args=[operand])
                      call_results = inferred.infer_call_result(self, context=context)
                      result = next(call_results, None)
                      if result is None:
                          # Failed to infer, return the same type.
                          yield operand
                      else:
                          yield result
                  except exceptions.AttributeInferenceError as exc:
                      # The unary operation special method was not found.
                      yield util.BadUnaryOperationMessage(operand, self.op, exc)
                  except exceptions.InferenceError:
                      yield util.Uninferable
docs: Infer what an UnaryOp should return when evaluated.