You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix 'was removed in version None' message in deprecated / deprecated_arg - #9291
Bare @deprecated() / @deprecated_arg() with no versions set treat the object as already removed and raise DeprecatedError claiming it "was removed in version None".
This makes the version phrase conditional on removed being set, so the bare case now says "was removed." while the versioned case still says "was removed in version ." — the same conditional-phrase pattern as #9197 for deprecated_arg_default.
Adds two message tests (test_except1_message, test_arg_except1_message) covering both the bare and versioned cases. No in-repo caller hits this today (all pass explicit versions); it bites downstream users who use the decorators without versions.
No actionable comments were generated in the recent review.
Walkthrough
The deprecated and deprecated_arg decorators now omit the removal-version clause when removed is None. When a removal version is set, the messages include it. Tests cover both cases for each decorator.
This change fixes the misleading "was removed in version None" error message for decorators with no version set. Versioned messages are unchanged, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the 'was removed in version None' message in deprecated and deprecated_arg. The raw summary and objectives confirm the change makes the version phrase conditional on r…
Description check
The description states the bug, the fix, the two added tests, and the test results. It follows the template's Description section, and the Types of changes section is filled in. The Fixes # line has n…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: the 'was removed in version None' message in deprecated and deprecated_arg. The raw summary and objectives confirm the change makes the version phrase conditional on removed being set. The title is specific and matches the changeset.
Full details: Description check
Explanation
The description states the bug, the fix, the two added tests, and the test results. It follows the template's Description section, and the Types of changes section is filled in. The Fixes # line has no issue number, and the checklist lacks ticks for the test and docstring items. Those gaps are minor, so the description is mostly complete.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between a85d75e and 897d585.
Files selected for processing: 2
monai/utils/deprecate_utils.py
tests/utils/test_deprecated.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This branch has not been deployed
No deployments
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
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.
Bare
@deprecated()/@deprecated_arg()with no versions set treat the object as already removed and raiseDeprecatedErrorclaiming it "was removed in version None".This makes the version phrase conditional on
removedbeing set, so the bare case now says "was removed." while the versioned case still says "was removed in version ." — the same conditional-phrase pattern as #9197 fordeprecated_arg_default.Adds two message tests (
test_except1_message,test_arg_except1_message) covering both the bare and versioned cases. No in-repo caller hits this today (all pass explicit versions); it bites downstream users who use the decorators without versions.tests/utils/test_deprecated.py: 33 passed (31 existing + 2 new).Signed-off-by: Ilyass Emssaad emssaadelias@gmail.com