microsoft/qlib · error · NotImplementedError

Subclass of CalendarStorage must implement `insert` method

Error message

Subclass of CalendarStorage must implement `insert` method

What it means

Error "Subclass of CalendarStorage must implement `insert` method" thrown in microsoft/qlib.

Source

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

        raise NotImplementedError("Subclass of CalendarStorage must implement `data` method")

    def clear(self) -> None:
        raise NotImplementedError("Subclass of CalendarStorage must implement `clear` method")

    def extend(self, iterable: Iterable[CalVT]) -> None:
        raise NotImplementedError("Subclass of CalendarStorage must implement `extend` method")

    def index(self, value: CalVT) -> int:
        """
        Raises
        ------
        ValueError
            If the data(storage) does not exist, raise ValueError
        """
        raise NotImplementedError("Subclass of CalendarStorage must implement `index` method")

    def insert(self, index: int, value: CalVT) -> None:
        raise NotImplementedError("Subclass of CalendarStorage must implement `insert` method")

    def remove(self, value: CalVT) -> None:
        raise NotImplementedError("Subclass of CalendarStorage must implement `remove` method")

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

    @overload
    def __setitem__(self, s: slice, value: Iterable[CalVT]) -> None:
        """x.__setitem__(s, o) <==> (x[s] = o)"""

    def __setitem__(self, i, value) -> None:
        raise NotImplementedError(
            "Subclass of CalendarStorage must implement `__setitem__(i: int, o: CalVT)`/`__setitem__(s: slice, o: Iterable[CalVT])`  method"
        )

    @overload

View on GitHub (pinned to 79633dd950)

Solutions

  1. Implement the `insert` method in your CalendarStorage subclass.
  2. Use the built-in FileCalendarStorage which implements `insert`.

When it happens

Trigger: This error is raised at qlib/data/storage/storage.py:121 when the guard condition fails: "Subclass of CalendarStorage must implement `insert` 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/4881a02a7c32a035. Report an issue: GitHub.