mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 15:34:01 -07:00
simplify string formatting in some modules (#10727)
* simplify string formatting in some modules * add changelog frag
This commit is contained in:
parent
3cc4f28fd7
commit
6f40eff632
10 changed files with 23 additions and 13 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue