Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/copilot/generated/session_events.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions scripts/codegen/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2538,8 +2538,9 @@ export function generatePythonSessionEventsCode(schema: JSONSchema7): string {
out.push(`def to_timedelta_int(x: timedelta) -> int:`);
out.push(` assert isinstance(x, timedelta)`);
out.push(` milliseconds = x.total_seconds() * 1000.0`);
out.push(` assert milliseconds.is_integer()`);
out.push(` return int(milliseconds)`);
out.push(` # Durations can carry sub-millisecond precision; round to the nearest whole ms`);
out.push(` # using Python's default banker's rounding (round-half-to-even).`);
out.push(` return round(milliseconds)`);
out.push(``);
out.push(``);
}
Expand Down