[PR #10727/6f40eff6 backport][stable-11] simplify string formatting in some modules (#10773)

simplify string formatting in some modules (#10727)

* simplify string formatting in some modules

* add changelog frag

(cherry picked from commit 6f40eff632)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2025-08-31 12:11:27 +02:00 committed by GitHub
commit 25ffe69b51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 23 additions and 13 deletions

View file

@ -304,7 +304,7 @@ def split_size_unit(string, isint=False):
Support optional space(s) between the numeric value and the unit.
"""
unit = re.sub(r'(\d|\.)', r'', string).strip()
value = float(re.sub(r'%s' % unit, r'', string).strip())
value = float(re.sub(unit, r'', string).strip())
if isint and unit in ('B', ''):
if int(value) != value:
raise AssertionError("invalid blocksize value: bytes require an integer value")