crumbs.py
def check_crumb_def(crumbdef):
    """Do some sanity checking on the crumb definition file.  This is not
    at all comprehensive, but will catch a lot of common errors.  Unfortunately,
    errors that aren't caught will probably cause some really odd behavior.
    """

    if 'wordsize' not in crumbdef:
        raise CrumbError('Definition of word size for target platform required ("wordsize":bits).')

    if 'byteorder' not in crumbdef:
        raise CrumbError('Byte order must be specified (add "byteorder:big|little|netword").')

    cats = []
    for c in crumbdef['categories']:
        if 'name' not in c:
            raise CrumbError('Category requires a name field.')

        if c['name'] in cats:
            raise CrumbError('Category "%s" previously defined.' % c['name'])

        cats.append(c['name'])

    if 'filters' in crumbdef:
        if not isinstance(crumbdef['filters'], bool):
            raise CrumbError('The "filters" field must be true or false.')
Do some sanity checking on the crumb definition file.  This is not
    at all comprehensive, but will catch a lot of common errors.  Unfortunately,
    errors that aren't caught will probably cause some really odd behavior.
    
Do some sanity checking on the crumb definition file.  This is not
at all comprehensive, but will catch a lot of common errors.  Unfortunately,
errors that aren't caught will probably cause some really odd behavior.
Do some sanity checking on the crumb definition file . This is not at all comprehensive but will catch a lot of common errors . Unfortunately errors that aren ' t caught will probably cause some really odd behavior .
def check_crumb_def(crumbdef):
    if 'wordsize' not in crumbdef:
        raise CrumbError('Definition of word size for target platform required ("wordsize":bits).')
    if 'byteorder' not in crumbdef:
        raise CrumbError('Byte order must be specified (add "byteorder:big|little|netword").')
    cats = []
    for c in crumbdef['categories']:
        if 'name' not in c:
            raise CrumbError('Category requires a name field.')
        if c['name'] in cats:
            raise CrumbError('Category "%s" previously defined.' % c['name'])
        cats.append(c['name'])
    if 'filters' in crumbdef:
        if not isinstance(crumbdef['filters'], bool):
            raise CrumbError('The "filters" field must be true or false.')
def check_crumb_def ( crumbdef ) : if 'wordsize' not in crumbdef : raise CrumbError ( 'Definition of word size for target platform required ("wordsize":bits).' ) if 'byteorder' not in crumbdef : raise CrumbError ( 'Byte order must be specified (add "byteorder:big|little|netword").' ) cats = [ ] for c in crumbdef [ 'categories' ] : if 'name' not in c : raise CrumbError ( 'Category requires a name field.' ) if c [ 'name' ] in cats : raise CrumbError ( 'Category "%s" previously defined.' % c [ 'name' ] ) cats . append ( c [ 'name' ] ) if 'filters' in crumbdef : if not isinstance ( crumbdef [ 'filters' ] , bool ) : raise CrumbError ( 'The "filters" field must be true or false.' )
Do some sanity checking on the crumb definition file.
Do some sanity checking on the crumb definition file .
"""Do some sanity checking on the crumb definition file.  This is not
    at all comprehensive, but will catch a lot of common errors.  Unfortunately,
    errors that aren't caught will probably cause some really odd behavior.
    """
crumbdef