Ejemplo n.º 1
0
def validate_libraryReadLength(value, displayedName='Library Read Length'):
    errors = []
    if type(value) != int and value.isdigit():
        value2 = int(value)
    else:
        value2 = value
        
    if type(value2) == int:
        if not validation.is_valid_uint_n_zero(value2):
            errors.append(validation.invalid_uint(displayedName))
        elif MIN_LIBRARY_READ_LENGTH < value2 > MAX_LIBRARY_READ_LENGTH:
            errors.append(displayedName + ' must be a positive integer within range [0, 1000]' )        
    else:
        errors.append(displayedName + ' must be a positive integer within range [0, 1000]' )        
    
    return errors
Ejemplo n.º 2
0
def validate_libraryReadLength(value, field_label):
    errors = []
    if type(value) != int and value.isdigit():
        value2 = int(value)
    else:
        value2 = value

    if type(value2) == int:
        if not validation.is_valid_uint_n_zero(value2):
            errors.append(validation.invalid_uint(field_label))
        elif value2 < MIN_LIBRARY_READ_LENGTH:
            errors.append(
                validation.invalid_range(field_label, MIN_LIBRARY_READ_LENGTH,
                                         MAX_LIBRARY_READ_LENGTH))
        elif value2 > MAX_LIBRARY_READ_LENGTH:
            errors.append(
                validation.invalid_range(field_label, MIN_LIBRARY_READ_LENGTH,
                                         MAX_LIBRARY_READ_LENGTH))
    else:
        errors.append(
            validation.invalid_range(field_label, MIN_LIBRARY_READ_LENGTH,
                                     MAX_LIBRARY_READ_LENGTH))

    return errors