from collections.abc import Iterable, Iterator, Sequence
from typing import (
    Any,
    Literal,
    NoReturn,
    SupportsIndex,
    overload,
)
from typing_extensions import Never, Self, TypeIs

import numpy as np
import numpy.typing as npt

from ._base import sparray
from ._bsr import bsr_array, bsr_matrix
from ._coo import coo_array, coo_matrix
from ._csc import csc_array, csc_matrix
from ._csr import csr_array, csr_matrix
from ._dia import dia_array, dia_matrix
from ._index import IndexMixin
from ._lil import lil_array, lil_matrix
from ._matrix import spmatrix
from .typing import (
    _SCT,
    SparseArray,
    _ArrayType,
    _CastingKind,
    _DType_co,
    _DTypeLike,
    _Formats,
    _NumberLike_co,
    _OrderType,
    _SCT_co,
    _SCT_uifcO,
    _ShapeAnno,
    _ShapeLike,
)

__all__ = ["dok_array", "dok_matrix", "isspmatrix_dok"]

def isspmatrix_dok(x: Any) -> TypeIs[dok_matrix[Any, Any]]: ...

class dok_array(  # type: ignore[misc]
    sparray[_ShapeAnno, _DType_co],
    IndexMixin,
    dict[Sequence[SupportsIndex], Any],
):
{array_body}
    def __reversed__(self) -> NoReturn: ...
    def __or__(self, other: Never) -> NoReturn: ...  # type: ignore[override]
    def __ror__(self, other: Never) -> NoReturn: ...  # type: ignore[override]
    def __ior__(self, other: Never) -> NoReturn: ...  # type: ignore[override]

class dok_matrix(  # type: ignore[misc]
    spmatrix[_ShapeAnno, _DType_co],
    IndexMixin,
    dict[Sequence[SupportsIndex], Any],
):
{matrix_body}
