class_docstr: common ops mixin to support a unified interface datetimelike Index
class_docstr_tok: ["common","ops","mixin","to","support","a","unified","interface","datetimelike","Index"]
docstr: Add in the datetimelike methods (as we may have to override the
  superclass).
code: def _add_datetimelike_methods(cls):
      """
      Add in the datetimelike methods (as we may have to override the
      superclass).
      """
  
      def __add__(self, other):
          # dispatch to ExtensionArray implementation
          result = self._data.__add__(maybe_unwrap_index(other))
          return wrap_arithmetic_op(self, other, result)
  
      cls.__add__ = __add__
  
      def __radd__(self, other):
          # alias for __add__
          return self.__add__(other)
  
      cls.__radd__ = __radd__
  
      def __sub__(self, other):
          # dispatch to ExtensionArray implementation
          result = self._data.__sub__(maybe_unwrap_index(other))
          return wrap_arithmetic_op(self, other, result)
  
      cls.__sub__ = __sub__
  
      def __rsub__(self, other):
          result = self._data.__rsub__(maybe_unwrap_index(other))
          return wrap_arithmetic_op(self, other, result)
  
      cls.__rsub__ = __rsub__
  
imports: import operator
  import warnings
  import numpy
  from pandas._libs import NaT, iNaT, lib
  from pandas.compat.numpy import function
  from pandas.errors import AbstractMethodError
  from pandas.util._decorators import Appender, cache_readonly, deprecate_kwarg
  from pandas.core.dtypes.common import ensure_int64, is_dtype_equal, is_float, is_integer, is_list_like, is_period_dtype, is_scalar
  from pandas.core.dtypes.generic import ABCIndex, ABCIndexClass, ABCSeries
  from pandas.core import algorithms, ops
  from pandas.core.accessor import PandasDelegate
  from pandas.core.arrays import ExtensionOpsMixin
  from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin, _ensure_datetimelike_to_i8
  import pandas.core.indexes.base
  from pandas.core.indexes.base import Index, _index_shared_docs
  from pandas.core.tools.timedeltas import to_timedelta
  import pandas.io.formats.printing
label_desc: Use image node_id 28 for calling the DatetimeIndexOpsMixin obj's underlying member method code with example usage: obj._add_datetimelike_methods(cls) and returns: wrap_arithmetic_op, self, wrap_arithmetic_op, wrap_arithmetic_op