typing/annotators: Simplify type annotations in docstrings by removing redundant type details#2086
typing/annotators: Simplify type annotations in docstrings by removing redundant type details#2086
Conversation
Codecov Report❌ Patch coverage is 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:
|
There was a problem hiding this comment.
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.
…ame_id` in `put` method
This pull request primarily improves type annotations and docstring formatting for several utility functions in the
supervisioncodebase. The changes enhance code clarity and maintainability by making argument types and return values more explicit and by standardizing docstring formats.Type annotation improvements:
wrap_textandvalidate_labelsinsupervision/annotators/utils.py. [1] [2]Docstring and documentation consistency:
wrap_text,validate_labels,get_labels_text,snap_boxes, andmerge) to standardize argument and return value descriptions, improving readability and consistency across the codebase. [1] [2] [3] [4] [5]Part of #2088