toyplot.require module

Functions for validating inputs.

toyplot.require.filename(value)[source]
toyplot.require.instance(value, types)[source]

Verify the type of a value.

toyplot.require.integer_vector(value, length=None, min_length=None, modulus=None)[source]
toyplot.require.optional_string(value)[source]
toyplot.require.scalar(value)[source]
toyplot.require.scalar_array(value)[source]
toyplot.require.scalar_matrix(value, rows=None, columns=None)[source]
toyplot.require.scalar_vector(value, length=None, min_length=None, modulus=None)[source]
toyplot.require.string_vector(value, length=None, min_length=None, modulus=None)[source]
toyplot.require.style(value, allowed)[source]

Validate that an object is usable as CSS style information.

Parameters:
  • value (dict or None) – The style object to be validated. An exception will be raised if it is not a valid style object.
  • allowed (sequence of strings) – The set of allowed style keys. An exception will be raised if value contains any keys that aren’t in this sequence.
Returns:

style

Return type:

the validated style object.

toyplot.require.table_keys(table, keys, length=None, min_length=None, modulus=None)[source]
toyplot.require.value_in(value, choices)[source]
toyplot.require.vector(value, length=None, min_length=None, modulus=None)[source]