Skip to content

fix: align return to type to its hint#234

Merged
ktro2828 merged 1 commit into
mainfrom
fix/return-type
Nov 19, 2025
Merged

fix: align return to type to its hint#234
ktro2828 merged 1 commit into
mainfrom
fix/return-type

Conversation

@ktro2828

Copy link
Copy Markdown
Collaborator

What

This pull request makes minor improvements to type consistency and return values in geometry and box utility functions. The changes ensure that functions always return native Python types instead of NumPy types, which can help prevent subtle bugs and improve interoperability.

  • Type consistency improvements:
    • Updated the is_box_in_image function in geometry.py to explicitly cast NumPy boolean results to Python bool before returning, ensuring consistent return types.
    • Modified the distance_box function in box.py to return a native Python float using .item(), rather than a NumPy scalar, for better type consistency.

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Copilot AI review requested due to automatic review settings November 19, 2025 01:41
@github-actions github-actions Bot added the bug Something isn't working label Nov 19, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves type consistency by ensuring utility functions return native Python types instead of NumPy types. This prevents potential type-related bugs and improves interoperability with code expecting standard Python types.

Key Changes:

  • Converted NumPy boolean returns to Python bool in visibility checks
  • Converted NumPy scalar distance to Python float using .item()

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
t4_devkit/dataclass/box.py Modified distance_box to return native Python float instead of NumPy scalar
t4_devkit/common/geometry.py Added explicit bool casting to is_box_in_image return statements for type consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
3971 3267 82% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/common/geometry.py 98% 🟢
t4_devkit/dataclass/box.py 83% 🟢
TOTAL 91% 🟢

updated for commit: d994148 by action🐍

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
3971 3267 82% 50% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
t4_devkit/common/geometry.py 98% 🟢
t4_devkit/dataclass/box.py 83% 🟢
TOTAL 91% 🟢

updated for commit: d994148 by action🐍

@ktro2828 ktro2828 merged commit 423003d into main Nov 19, 2025
4 of 5 checks passed
@ktro2828 ktro2828 deleted the fix/return-type branch November 19, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants