{"record":{"id":"54f7621f4b875f12","repo":"microsoft/qlib","slug":"this-type-of-input-is-not-supported-54f762","errorCode":null,"errorMessage":"This type of input is not supported","messagePattern":"This type of input is not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/workflow/task/utils.py","lineNumber":141,"sourceCode":"        Parameters\n        ----------\n        time_point\n        tp_type : str\n\n        Returns\n        -------\n        index : int\n        \"\"\"\n        if time_point is None:\n            # `None` indicates unbounded index/boarder\n            return None\n        time_point = pd.Timestamp(time_point)\n        if tp_type == \"start\":\n            idx = bisect.bisect_left(self.cals, time_point)\n        elif tp_type == \"end\":\n            idx = bisect.bisect_right(self.cals, time_point) - 1\n        else:\n            raise NotImplementedError(f\"This type of input is not supported\")\n        return idx\n\n    def cal_interval(self, time_point_A, time_point_B) -> int:\n        \"\"\"\n        Calculate the trading day interval (time_point_A - time_point_B)\n\n        Args:\n            time_point_A : time_point_A\n            time_point_B : time_point_B (is the past of time_point_A)\n\n        Returns:\n            int: the interval between A and B\n        \"\"\"\n        return self.align_idx(time_point_A) - self.align_idx(time_point_B)\n\n    def align_time(self, time_point, tp_type=\"start\") -> pd.Timestamp:\n        \"\"\"\n        Align time_point to trade date of calendar","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/workflow/task/utils.py#L123-L159","documentation":"Raised by CalendarProvider.align_idx when tp_type is neither 'start' nor 'end'. The method maps a timestamp to a calendar index via bisect on self.cals; any other tp_type string is unsupported.","triggerScenarios":"Calling align_time/align_idx (or code inside TaskGen that calls it) with tp_type='middle', tp_type=None, or a typo like 'Start' instead of 'start'.","commonSituations":"Custom dataset/task generator code that copies align_time but passes a different third positional/keyword argument; subclassing and overriding shift/align helpers with an extra rtype value that leaks into tp_type.","solutions":["Use only tp_type='start' or tp_type='end'.","Prefer the public wrappers align_time/align_seg/shift which set tp_type correctly instead of calling align_idx directly."],"exampleFix":"// before\nidx = cal.align_idx(ts, tp_type=\"begin\")\n\n// after\nidx = cal.align_idx(ts, tp_type=\"start\")","handlingStrategy":"validation","validationCode":"assert tp_type in (\"start\", \"end\"), f\"tp_type must be start/end, got {tp_type}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer align_time/align_seg wrappers over raw align_idx.","Use the literal strings 'start'/'end'; avoid propagating user input into tp_type."],"tags":["qlib","calendar","argument-validation"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}