refactor: replace sec2us and us2sec to seconds2microseconds and microseconds2seconds#230
Merged
Conversation
…seconds2seconds Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors timestamp conversion utilities by introducing clearly named functions microseconds2seconds and seconds2microseconds to replace the abbreviated us2sec and sec2us functions. The old functions are deprecated but retained for backward compatibility, while all internal usages have been migrated to the new naming convention.
Key changes:
- New timestamp conversion functions with descriptive names added to
t4_devkit/common/timestamp.py - Old
us2secandsec2usfunctions marked as deprecated using@deprecateddecorator - All imports and function calls updated across the codebase to use new function names
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| t4_devkit/common/timestamp.py | Added new microseconds2seconds and seconds2microseconds functions; deprecated old us2sec and sec2us functions |
| t4_devkit/helper/rendering.py | Updated imports and all function calls to use new timestamp conversion functions |
| t4_devkit/helper/timeseries.py | Updated imports and function calls to use microseconds2seconds |
| t4_devkit/viewer/viewer.py | Updated import and function call to use microseconds2seconds |
| tests/common/test_timestamp.py | Updated test to import and use new timestamp conversion functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This pull request refactors and modernizes the timestamp conversion utilities across the codebase. It introduces new, clearly named functions (
microseconds2secondsandseconds2microseconds) to replace the olderus2secandsec2usfunctions, which are now marked as deprecated. All usages throughout the project have been updated to use the new functions, improving code readability and future maintainability.Timestamp utility modernization:
microseconds2seconds(converts microseconds to seconds) andseconds2microseconds(converts seconds to microseconds) int4_devkit/common/timestamp.py. Updated__all__to only export these new functions.us2secandsec2usfunctions as deprecated using the@deprecateddecorator, and updated their implementations to call the new functions.Codebase-wide updates:
us2secandsec2uswithmicroseconds2secondsandseconds2microsecondsint4_devkit/helper/rendering.py,t4_devkit/helper/timeseries.py, andt4_devkit/viewer/viewer.py. [1] [2] [3]Testing:
tests/common/test_timestamp.pyto use the new timestamp conversion functions, ensuring tests reflect the updated API.