Skip to content

Conversation

@auvipy
Copy link
Member

@auvipy auvipy commented Jul 16, 2025

Reverts #2225

@auvipy auvipy requested a review from Copilot July 16, 2025 06:00

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jul 16, 2025

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.85%. Comparing base (4c9fb4b) to head (4ce1c95).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
kombu/utils/text.py 90.47% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@auvipy auvipy requested a review from Copilot July 16, 2025 06:06
Copy link
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 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_tuple to use a fullmatch regex and updated _unpack_version signature.
  • Cleaned up formatting in escape_regex, fmatch_iter, and fmatch_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

Comment on lines 45 to +50
return sorted(
fmatch_iter(needle, haystack, min_ratio), reverse=True,
)[0][1]
fmatch_iter(needle, haystack, min_ratio),
reverse=True,
)[
0
][1]
Copy link

Copilot AI Jul 16, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

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(
Copy link

Copilot AI Jul 16, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

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?

@auvipy auvipy force-pushed the revert-2225-revert-2098-bugfix/type-error-version-checking branch from 538b219 to 4ce1c95 Compare August 8, 2025 15:51
@auvipy auvipy added this to the 5.7.0 milestone Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants