-
-
Couldn't load subscription status.
- Fork 970
Revert "Revert "Resolving TypeError, during version unpacking "" #2333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Revert "Revert "Resolving TypeError, during version unpacking "" #2333
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2333 +/- ##
==========================================
- Coverage 81.11% 80.85% -0.26%
==========================================
Files 77 77
Lines 9705 9689 -16
Branches 1195 1194 -1
==========================================
- Hits 7872 7834 -38
- Misses 1628 1636 +8
- Partials 205 219 +14 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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 PR reverts the previous revert of version unpacking logic (#2225), reintroducing an updated regex-based parsing approach and extending test coverage.
- Added new test cases for complex version strings in
test_utils.py. - Refactored
version_string_as_tupleto use a fullmatch regex and updated_unpack_versionsignature. - Cleaned up formatting in
escape_regex,fmatch_iter, andfmatch_best.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| t/unit/utils/test_utils.py | Reformatted @pytest.mark.parametrize and added tests for additional version patterns |
| kombu/utils/text.py | Introduced regex parsing in version_string_as_tuple, updated helper signatures, and adjusted utility formatting |
| return sorted( | ||
| fmatch_iter(needle, haystack, min_ratio), reverse=True, | ||
| )[0][1] | ||
| fmatch_iter(needle, haystack, min_ratio), | ||
| reverse=True, | ||
| )[ | ||
| 0 | ||
| ][1] |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sorted() to find the best match sorts the entire iterable, which is inefficient if only the max is needed. Consider using max(fmatch_iter(...), key=lambda x: x[0], default=(None, None))[1] to avoid constructing a full list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this @couzhei
|
|
||
|
|
||
| def _splitmicro(micro: str, releaselevel: str = '', serial: str = '') -> tuple[int, str, str]: | ||
| def _splitmicro( |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _splitmicro helper is no longer referenced by version_string_as_tuple and appears unused. Consider removing it to eliminate dead code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@couzhei what is your take on this?
538b219 to
4ce1c95
Compare
Reverts #2225