API¶
Global variables¶
Functions¶
Classes¶
Contracts pseudo-types¶
Introduction¶
The pseudo-types defined below can be used in contracts of the PyContracts or Pexdoc libraries. As an example, with the latter:
>>> from __future__ import print_function >>> import pexdoc >>> from pplot.ptypes import interpolation_option >>> @pexdoc.pcontracts.contract(ioption='interpolation_option') ... def myfunc(ioption): ... print('Option received: '+str(ioption)) ... >>> myfunc('STEP') Option received: STEP >>> myfunc(35) Traceback (most recent call last): ... RuntimeError: Argument `ioption` is not valid
Alternatively each pseudo-type has a checker function associated with it that can be used to verify membership. For example:
>>> import pplot.ptypes >>> # None is returned if object belongs to pseudo-type >>> pplot.ptypes.interpolation_option('STEP') >>> # ValueError is raised if object does not belong to pseudo-type >>> pplot.ptypes.interpolation_option(3.5) Traceback (most recent call last): ... ValueError: [START CONTRACT MSG: interpolation_option]...
Description¶
ColorSpaceOption¶
Import as color_space_option. String representing a Matplotlib color space, one 'binary', 'Blues',
'BuGn', 'BuPu', 'GnBu', 'Greens',
'Greys', 'Oranges', 'OrRd', 'PuBu',
'PuBuGn', 'PuRd', 'Purples', 'RdPu',
'Reds', 'YlGn', 'YlGnBu', 'YlOrBr’,
'YlOrRd' or None
InterpolationOption¶
Import as interpolation_option. String representing an interpolation
type, one of 'STRAIGHT', 'STEP', 'CUBIC',
'LINREG' (case insensitive) or None
LineStyleOption¶
Import as line_style_option. String representing a Matplotlib line
style, one of '-', '--', '-.', ':' or
None