{ } Raw JSON

bundles / astropy 7.0.1 / astropy / extern / configobj / validate / is_list

function

astropy.extern.configobj.validate:is_list

source: /astropy/extern/configobj/validate.py :994

Signature

def   is_list ( value min = None max = None )

Summary

Check that the value is a list of values.

Extended Summary

You can optionally specify the minimum and maximum number of members.

It does no check on list members.

>>> vtor.check('list', ())
[]
>>> vtor.check('list', [])
[]
>>> vtor.check('list', (1, 2))
[1, 2]
>>> vtor.check('list', [1, 2])
[1, 2]
>>> vtor.check('list(3)', (1, 2))
Traceback (most recent call last):
VdtValueTooShortError: the value "(1, 2)" is too short.
>>> vtor.check('list(max=5)', (1, 2, 3, 4, 5, 6))
Traceback (most recent call last):
VdtValueTooLongError: the value "(1, 2, 3, 4, 5, 6)" is too long.
>>> vtor.check('list(min=3, max=5)', (1, 2, 3, 4))
[1, 2, 3, 4]
>>> vtor.check('list', 0)
Traceback (most recent call last):
VdtTypeError: the value "0" is of the wrong type.
>>> vtor.check('list', '12')
Traceback (most recent call last):
VdtTypeError: the value "12" is of the wrong type.

Aliases

  • astropy.config.configuration.validate.is_list