Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(31)  |  Call(29)  |  Derive(0)  |  Import(2)
One of the given types.

>>> from .validator import validate
>>> validate(one_of(str(), number()), 'foo')
>>> validate(one_of(str(), number()), 32)

src/m/a/MapProxy-1.6.0/mapproxy/config/spec.py   MapProxy(Download)
 
from mapproxy.util.ext.dictspec.validator import validate, ValidationError
from mapproxy.util.ext.dictspec.spec import one_of, anything, number
from mapproxy.util.ext.dictspec.spec import recursive, required, type_spec, combined
 
    'polygons': str(),
    'polygons_srs': str(),
    'bbox': one_of(str(), [number()]),
    'bbox_srs': str(),
    'ogr_datasource': str(),
    'ogr_where': str(),
    'ogr_srs': str(),
    'datasource': one_of(str(), [number()]),
    'riak': {
        'nodes': [riak_node],
        'protocol': one_of('pbc', 'http', 'https'),
        'bucket': str(),
        'default_ports': {
on_error = {
    anything(): {
        required('response'): one_of([int], str),
        'cache': bool,
    }

src/m/a/mapproxy-HEAD/mapproxy/config/spec.py   mapproxy(Download)
 
from mapproxy.util.ext.dictspec.validator import validate, ValidationError
from mapproxy.util.ext.dictspec.spec import one_of, anything, number
from mapproxy.util.ext.dictspec.spec import recursive, required, type_spec, combined
 
    'polygons': str(),
    'polygons_srs': str(),
    'bbox': one_of(str(), [number()]),
    'bbox_srs': str(),
    'ogr_datasource': str(),
    'ogr_where': str(),
    'ogr_srs': str(),
    'datasource': one_of(str(), [number()]),
    'riak': {
        'nodes': [riak_node],
        'protocol': one_of('pbc', 'http', 'https'),
        'bucket': str(),
        'default_ports': {
on_error = {
    anything(): {
        required('response'): one_of([int], str),
        'cache': bool,
    }