code: def __init__(self, arg1, shape=None, dtype=None, copy=False):
      _data_matrix.__init__(self)
      is_array = isinstance(self, sparray)
  
      if isinstance(arg1, tuple):
          if isshape(arg1, allow_1d=is_array):
              self._shape = check_shape(arg1, allow_1d=is_array)
              idx_dtype = self._get_index_dtype(maxval=max(self._shape))
              data_dtype = getdtype(dtype, default=float)
              self.indices = tuple(
                  np.array([], dtype=idx_dtype)
                  for _ in range(len(self._shape))
              )
              self.data = np.array([], dtype=data_dtype)
              self.has_canonical_format = True
          else:
              try:
                  obj, indices = arg1
              except (TypeError, ValueError) as e:
                  raise TypeError("invalid input format") from e
  
              if shape is None:
                  if any(len(idx) == 0 for idx in indices):
                      raise ValueError(
                          "cannot infer dimensions from zero "
                          "sized index arrays"
                      )
                  shape = tuple(
                      operator.index(np.max(idx)) + 1 for idx in indices
                  )
              self._shape = check_shape(shape, allow_1d=is_array)
  
              idx_dtype = self._get_index_dtype(
                  indices, maxval=max(self.shape), check_contents=True
              )
              self.indices = tuple(
                  np.array(idx, copy=copy, dtype=idx_dtype)
                  for idx in indices
              )
              self.data = getdata(obj, copy=copy, dtype=dtype)
              self.has_canonical_format = False
      else:
          if issparse(arg1):
              if arg1.format == self.format and copy:
                  self.indices = tuple(
                      idx.copy() for idx in arg1.indices
                  )
                  self.data = arg1.data.copy()
                  self._shape = check_shape(
                      arg1.shape, allow_1d=is_array
                  )
                  self.has_canonical_format = arg1.has_canonical_format
              else:
                  coo = arg1.tocoo()
                  self.indices = tuple(coo.indices)
                  self.data = coo.data
                  self._shape = check_shape(
                      coo.shape, allow_1d=is_array
                  )
                  self.has_canonical_format = False
          else:
              # dense argument
              M = np.asarray(arg1)
              if not is_array:
                  M = np.atleast_2d(M)
                  if M.ndim != 2:
                      raise TypeError(
                          "expected dimension <= 2 array or matrix"
                      )
  
              self._shape = check_shape(M.shape, allow_1d=is_array)
              if shape is not None:
                  if (
                      check_shape(shape, allow_1d=is_array)
                      != self._shape
                  ):
                      message = f"inconsistent shapes: {shape} != {self._shape}"
                      raise ValueError(message)
              index_dtype = self._get_index_dtype(
                  maxval=max(self._shape)
              )
              indices = M.nonzero()
              self.indices = tuple(
                  idx.astype(index_dtype, copy=False) for idx in indices
              )
              self.data = M[indices]
              self.has_canonical_format = True
  
      if dtype is not None:
          self.data = self.data.astype(dtype, copy=False)
  
      self._check()
  
imports: import math
  from warnings import warn
  import numpy
  from ._matrix import spmatrix
  from ._sparsetools import coo_tocsr, coo_todense, coo_matvec
  from ._base import issparse, SparseEfficiencyWarning, _spbase, sparray
  from ._data import _data_matrix, _minmax_mixin
  from ._sputils import upcast, upcast_char, to_native, isshape, getdtype, getdata, downcast_intp_index, get_index_dtype, check_shape, check_reshape_kwargs
  import operator
label_desc: Use image node_id 1 to create a new _coo_base object from inherited base classes: _data_matrix, _minmax_mixin with example: obj = _coo_base(arg1, shape, dtype, copy)