append api call

This commit is contained in:
Matthias 2021-12-29 02:24:00 +01:00
parent f8ce23217e
commit c9f0528dfc
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -404,17 +404,19 @@ def DownloadFile(data, filename, content_type='application/text', inline=False):
return response
def extract_serial_numbers(serials, expected_quantity):
def extract_serial_numbers(serials, expected_quantity, next_number: int):
""" Attempt to extract serial numbers from an input string.
- Serial numbers must be integer values
- Serial numbers must be positive
- Serial numbers can be split by whitespace / newline / commma chars
- Serial numbers can be supplied as an inclusive range using hyphen char e.g. 10-20
- Serial numbers can be defined as ~ for getting the next available serial number
- Serial numbers can be supplied as <start>+ for getting all expecteded numbers starting from <start>
- Serial numbers can be supplied as <start>+<length> for getting <length> numbers starting from <start>
Args:
expected_quantity: The number of (unique) serial numbers we expect
next_number(int): the next possible serial number
"""
serials = serials.strip()