Skip to content

typing/annotators: Simplify type annotations in docstrings by removing redundant type details#2086

Merged
Borda merged 10 commits intodevelopfrom
typing/annotators
Jan 29, 2026
Merged

typing/annotators: Simplify type annotations in docstrings by removing redundant type details#2086
Borda merged 10 commits intodevelopfrom
typing/annotators

Conversation

@Borda
Copy link
Copy Markdown
Member

@Borda Borda commented Jan 20, 2026

This pull request primarily improves type annotations and docstring formatting for several utility functions in the supervision codebase. The changes enhance code clarity and maintainability by making argument types and return values more explicit and by standardizing docstring formats.

Type annotation improvements:

  • Added or clarified return type annotations for functions such as wrap_text and validate_labels in supervision/annotators/utils.py. [1] [2]

Docstring and documentation consistency:

  • Updated docstrings for multiple functions (wrap_text, validate_labels, get_labels_text, snap_boxes, and merge) to standardize argument and return value descriptions, improving readability and consistency across the codebase. [1] [2] [3] [4] [5]

Part of #2088

@Borda Borda requested a review from SkalskiP as a code owner January 20, 2026 08:18
Copilot AI review requested due to automatic review settings January 20, 2026 08:18
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 51.64835% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 59%. Comparing base (7bf03f5) to head (c27f0de).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2086   +/-   ##
=======================================
- Coverage       59%     59%   -0%     
=======================================
  Files           61      61           
  Lines         7086    7118   +32     
=======================================
+ Hits          4193    4196    +3     
- Misses        2893    2922   +29     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request simplifies type annotations in docstrings across the supervision codebase by removing redundant type information that is already captured in function signatures. The changes improve documentation clarity and maintainability by following the modern Python convention where type hints in function signatures serve as the primary source of type information.

Changes:

  • Removed redundant type annotations from docstring parameter descriptions (e.g., param (Type):param:)
  • Simplified return value descriptions by removing type information already present in return type annotations
  • Added explicit type hints to function signatures where they were missing (e.g., max_line_length: int | None = None)
  • Fixed minor formatting issues including line breaks in docstrings

Reviewed changes

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

File Description
supervision/detection/core.py Simplified docstring for the merge classmethod by removing redundant type annotations
supervision/annotators/utils.py Updated docstrings and added type hints for wrap_text, validate_labels, get_labels_text, and snap_boxes functions
supervision/annotators/core.py Extensive docstring simplification across all annotator classes, removing redundant type information from parameter and return descriptions while maintaining clarity

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

@Borda Borda added the enhancement New feature or request label Jan 29, 2026
@Borda Borda merged commit a765bd9 into develop Jan 29, 2026
26 checks passed
@Borda Borda deleted the typing/annotators branch January 29, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants