microsoft/qlib · error · NotImplementedError

Subclass of CalendarStorage must implement `__delitem__(i: i

Error message

Subclass of CalendarStorage must implement `__delitem__(i: int)`/`__delitem__(s: slice)`  method

What it means

Error "Subclass of CalendarStorage must implement `__delitem__(i: int)`/`__delitem__(s: slice)` method" thrown in microsoft/qlib.

Source

Thrown at qlib/data/storage/storage.py:154

            "Subclass of CalendarStorage must implement `__setitem__(i: int, o: CalVT)`/`__setitem__(s: slice, o: Iterable[CalVT])`  method"
        )

    @overload
    def __delitem__(self, i: int) -> None:
        """x.__delitem__(i) <==> del x[i]"""

    @overload
    def __delitem__(self, i: slice) -> None:
        """x.__delitem__(slice(start: int, stop: int, step: int)) <==> del x[start:stop:step]"""

    def __delitem__(self, i) -> None:
        """
        Raises
        ------
        ValueError
            If the data(storage) does not exist, raise ValueError
        """
        raise NotImplementedError(
            "Subclass of CalendarStorage must implement `__delitem__(i: int)`/`__delitem__(s: slice)`  method"
        )

    @overload
    def __getitem__(self, s: slice) -> Iterable[CalVT]:
        """x.__getitem__(slice(start: int, stop: int, step: int)) <==> x[start:stop:step]"""

    @overload
    def __getitem__(self, i: int) -> CalVT:
        """x.__getitem__(i) <==> x[i]"""

    def __getitem__(self, i) -> CalVT:
        """

        Raises
        ------
        ValueError
            If the data(storage) does not exist, raise ValueError

View on GitHub (pinned to 79633dd950)

Solutions

  1. Implement `__delitem__` (both int and slice forms) in your CalendarStorage subclass.
  2. Use the built-in FileCalendarStorage which implements `__delitem__`.

When it happens

Trigger: This error is raised at qlib/data/storage/storage.py:154 when the guard condition fails: "Subclass of CalendarStorage must implement `__delitem__` method". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/71ca8504c9fffaaf. Report an issue: GitHub.