Skip to content

Commit

Permalink
fix re.split maxsplit deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
pirate authored Nov 12, 2024
1 parent 395f1d2 commit 3a5b82d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic_pkgr/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def parse(cls, version_stdout: SemVerParsableTypes) -> Optional['SemVer']:
# raise Exception('Tried to parse semver from empty version output (is binary installed and available?)')
return None

just_numbers = lambda col: '.'.join([chunk for chunk in re.split(r'[\D]', col.lower().strip('v'), 10) if chunk.isdigit()][:3]) # split on any non-num character e.g. 5.2.26(1)-release -> ['5', '2', '26', '1', '', '', ...]
just_numbers = lambda col: '.'.join([chunk for chunk in re.split(r'[\D]', col.lower().strip('v'), maxsplit=10) if chunk.isdigit()][:3]) # split on any non-num character e.g. 5.2.26(1)-release -> ['5', '2', '26', '1', '', '', ...]
contains_semver = lambda col: (
col.count('.') in (1, 2, 3)
and all(chunk.isdigit() for chunk in col.split('.')[:3]) # first 3 chunks can only be nums
Expand Down

0 comments on commit 3a5b82d

Please sign in to comment.