(self, tool_task_state: ToolTaskState)
| 165 | _input_type = int |
| 166 | |
| 167 | def __call__(self, tool_task_state: ToolTaskState) -> ToolResult: |
| 168 | n = tool_task_state.messages[-1].content |
| 169 | n = try_cast_from_str(n, int) |
| 170 | if n is None: |
| 171 | return None |
| 172 | |
| 173 | count = 0 |
| 174 | for i in range(1, (int)(math.sqrt(n)) + 1): |
| 175 | if n % i == 0: |
| 176 | # If divisors are equal, count only one |
| 177 | if n / i == i: |
| 178 | count = count + 1 |
| 179 | else: # Otherwise count both |
| 180 | count = count + 2 |
| 181 | |
| 182 | return ToolResult(count) |
| 183 | |
| 184 | |
| 185 | class SumOfPalindromes(Tool): |
nothing calls this directly
no test coverage detected