{"record":{"id":"1b766d3a48bee0b4","repo":"microsoft/qlib","slug":"subclass-of-calendarstorage-must-implement-seti","errorCode":null,"errorMessage":"Subclass of CalendarStorage must implement `__setitem__(i: int, o: CalVT)`/`__setitem__(s: slice, o: Iterable[CalVT])`  method","messagePattern":"Subclass of CalendarStorage must implement `__setitem__\\(i: int, o: CalVT\\)`/`__setitem__\\(s: slice, o: Iterable\\[CalVT\\]\\)`  method","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/data/storage/storage.py","lineNumber":135,"sourceCode":"        \"\"\"\n        raise NotImplementedError(\"Subclass of CalendarStorage must implement `index` method\")\n\n    def insert(self, index: int, value: CalVT) -> None:\n        raise NotImplementedError(\"Subclass of CalendarStorage must implement `insert` method\")\n\n    def remove(self, value: CalVT) -> None:\n        raise NotImplementedError(\"Subclass of CalendarStorage must implement `remove` method\")\n\n    @overload\n    def __setitem__(self, i: int, value: CalVT) -> None:\n        \"\"\"x.__setitem__(i, o) <==> (x[i] = o)\"\"\"\n\n    @overload\n    def __setitem__(self, s: slice, value: Iterable[CalVT]) -> None:\n        \"\"\"x.__setitem__(s, o) <==> (x[s] = o)\"\"\"\n\n    def __setitem__(self, i, value) -> None:\n        raise NotImplementedError(\n            \"Subclass of CalendarStorage must implement `__setitem__(i: int, o: CalVT)`/`__setitem__(s: slice, o: Iterable[CalVT])`  method\"\n        )\n\n    @overload\n    def __delitem__(self, i: int) -> None:\n        \"\"\"x.__delitem__(i) <==> del x[i]\"\"\"\n\n    @overload\n    def __delitem__(self, i: slice) -> None:\n        \"\"\"x.__delitem__(slice(start: int, stop: int, step: int)) <==> del x[start:stop:step]\"\"\"\n\n    def __delitem__(self, i) -> None:\n        \"\"\"\n        Raises\n        ------\n        ValueError\n            If the data(storage) does not exist, raise ValueError\n        \"\"\"","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/storage/storage.py#L117-L153","documentation":"Error \"Subclass of CalendarStorage must implement `__setitem__(i: int, o: CalVT)`/`__setitem__(s: slice, o: Iterable[CalVT])`  method\" thrown in microsoft/qlib.","triggerScenarios":"This error is raised at qlib/data/storage/storage.py:135 when the guard condition fails: \"Subclass of CalendarStorage must implement `__setitem__` 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.","commonSituations":"See trigger scenarios.","solutions":["Implement `__setitem__` (both int and slice forms) in your CalendarStorage subclass.","Use the built-in FileCalendarStorage which implements `__setitem__`."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}