Commit dc85d0f
Fix/hitrate empty topk (#3719)
Fixes #3718
Description:
- Added validation for empty `top_k` list raising `ValueError` instead
of crashing with `IndexError` in `update()`
- Added support for `top_k: list[int] | int` so users can pass a single
int without wrapping in a list
- Added type validation raising `ValueError` if `top_k` is neither int
nor list
- Fixed leading space in existing error message
Check list:
- [x] New tests are added (if a new feature is added)
- [x] New doc strings: description and/or example code are in RST format
- [x] Documentation is updated (if required)
---------
Co-authored-by: vfdev <vfdev.5@gmail.com>1 parent fd1efbe commit dc85d0f
2 files changed
Lines changed: 53 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
100 | 121 | | |
| 122 | + | |
| 123 | + | |
101 | 124 | | |
102 | 125 | | |
103 | 126 | | |
104 | 127 | | |
105 | 128 | | |
106 | 129 | | |
107 | 130 | | |
108 | | - | |
| 131 | + | |
109 | 132 | | |
110 | 133 | | |
111 | 134 | | |
112 | 135 | | |
113 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
114 | 144 | | |
115 | | - | |
| 145 | + | |
116 | 146 | | |
117 | 147 | | |
118 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
57 | 77 | | |
58 | 78 | | |
59 | 79 | | |
| |||
0 commit comments