Module ImportFrom alias alias alias Import alias ImportFrom alias ImportFrom alias alias alias FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Return Call NameLoad NameLoad keyword NameLoad keyword NameLoad decorator_list Assign AttributeStore NameLoad attr NameLoad ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore TupleLoad Str Str Str Str Str Expr Yield NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad orelse Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad TryExcept body Assert CompareEq NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Yield TupleLoad Str Num NameLoad NameLoad AttributeLoad Call NameLoad NameLoad attr Assign NameStore NameLoad If NameLoad body Assign NameStore ListComp Call NameLoad NameLoad comprehension NameStore NameLoad For NameStore NameLoad body If CompareNotIn Str NameLoad body If CompareIn Str NameLoad body Assign NameStore Call NameLoad NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad Assert CompareEq NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Yield TupleLoad Str BinOpAdd NameLoad Num NameLoad NameLoad AttributeLoad Call NameLoad NameLoad attr If NameLoad body Assign NameStore Call NameLoad NameLoad NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Lambda arguments args NameParam defaults NameLoad TryExcept body Assign NameStore Call NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Yield TupleLoad NameLoad BinOpAdd NameLoad Num NameLoad NameLoad AttributeLoad Call NameLoad NameLoad attr orelse Assign NameStore IfExp NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body TryExcept body Expr Call NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Yield TupleLoad NameLoad BinOpAdd NameLoad Num NameLoad NameLoad AttributeLoad Call NameLoad NameLoad attr If CompareIsNot NameLoad NameLoad body TryExcept body Assert Call NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Yield TupleLoad NameLoad BinOpAdd NameLoad Num NameLoad NameLoad AttributeLoad Call NameLoad NameLoad attr decorator_list
N/A __future__ absolute_import print_function division N/A operator petl.compat text_type petl.util.base Table asindices Record validate N/A N/A table constraints header N/A None None N/A N/A 
    Validate a `table` against a set of `constraints` and/or an expected
    `header`, e.g.::

        >>> import petl as etl
        >>> # define some validation constraints
        ... header = ('foo', 'bar', 'baz')
        >>> constraints = [
        ...     dict(name='foo_int', field='foo', test=int),
        ...     dict(name='bar_date', field='bar', test=etl.dateparser('%Y-%m-%d')),
        ...     dict(name='baz_enum', field='baz', assertion=lambda v: v in ['Y', 'N']),
        ...     dict(name='not_none', assertion=lambda row: None not in row)
        ... ]
        >>> # now validate a table
        ... table = (('foo', 'bar', 'bazzz'),
        ...          (1, '2000-01-01', 'Y'),
        ...          ('x', '2010-10-10', 'N'),
        ...          (2, '2000/01/01', 'Y'),
        ...          (3, '2015-12-12', 'x'),
        ...          (4, None, 'N'),
        ...          ('y', '1999-99-99', 'z'),
        ...          (6, '2000-01-01'),
        ...          (7, '2001-02-02', 'N', True))
        >>> problems = etl.validate(table, constraints=constraints, header=header)
        >>> problems.lookall()
        +--------------+-----+-------+--------------+------------------+
        | name         | row | field | value        | error            |
        +==============+=====+=======+==============+==================+
        | '__header__' |   0 | None  | None         | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | 'foo_int'    |   2 | 'foo' | 'x'          | 'ValueError'     |
        +--------------+-----+-------+--------------+------------------+
        | 'bar_date'   |   3 | 'bar' | '2000/01/01' | 'ValueError'     |
        +--------------+-----+-------+--------------+------------------+
        | 'baz_enum'   |   4 | 'baz' | 'x'          | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | 'bar_date'   |   5 | 'bar' | None         | 'AttributeError' |
        +--------------+-----+-------+--------------+------------------+
        | 'not_none'   |   5 | None  | None         | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | 'foo_int'    |   6 | 'foo' | 'y'          | 'ValueError'     |
        +--------------+-----+-------+--------------+------------------+
        | 'bar_date'   |   6 | 'bar' | '1999-99-99' | 'ValueError'     |
        +--------------+-----+-------+--------------+------------------+
        | 'baz_enum'   |   6 | 'baz' | 'z'          | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | '__len__'    |   7 | None  |            2 | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | 'baz_enum'   |   7 | 'baz' | None         | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+
        | '__len__'    |   8 | None  |            4 | 'AssertionError' |
        +--------------+-----+-------+--------------+------------------+

    Returns a table of validation problems.

     N/A N/A ProblemsView table constraints constraints header header N/A N/A N/A Table validate validate ProblemsView N/A Table N/A __init__ N/A N/A self table constraints header N/A N/A N/A N/A self table table N/A N/A self constraints constraints N/A N/A self header header N/A __iter__ N/A N/A self N/A N/A N/A N/A iterproblems N/A self table N/A self constraints N/A self header N/A N/A iterproblems N/A N/A table constraints expected_header N/A N/A N/A outhdr N/A name row field value error N/A N/A outhdr N/A it N/A iter table N/A actual_header N/A next it N/A N/A expected_header None N/A N/A flds N/A list N/A map text_type actual_header N/A N/A expected_flds N/A list N/A map text_type expected_header N/A actual_flds N/A list N/A map text_type actual_header N/A N/A N/A N/A expected_flds actual_flds N/A N/A N/A Exception N/A e N/A N/A N/A N/A __header__ 0 None None N/A N/A type e __name__ N/A flds expected_flds N/A constraints N/A N/A constraints N/A N/A dict c N/A c constraints N/A constraint constraints N/A N/A N/A getter constraint N/A N/A N/A field constraint N/A N/A indices N/A asindices flds N/A constraint N/A field N/A getter N/A N/A operator itemgetter indices N/A N/A constraint N/A getter getter N/A expected_len N/A len flds N/A N/A i row N/A enumerate it N/A N/A row N/A tuple row N/A l None N/A N/A N/A l N/A len row N/A N/A l expected_len N/A N/A N/A Exception N/A e N/A N/A N/A N/A __len__ N/A i 1 None l N/A N/A type e __name__ N/A constraints N/A N/A row N/A Record row flds N/A constraint constraints N/A N/A name N/A N/A constraint get name None N/A field N/A N/A constraint get field None N/A assertion N/A N/A constraint get assertion None N/A test N/A N/A constraint get test None N/A getter N/A N/A constraint get getter N/A N/A N/A x N/A x N/A N/A N/A target N/A getter row N/A N/A N/A Exception N/A e N/A N/A N/A N/A name N/A i 1 field None N/A N/A type e __name__ N/A N/A value N/A field target None N/A N/A test None N/A N/A N/A N/A N/A test target N/A N/A N/A Exception N/A e N/A N/A N/A N/A name N/A i 1 field value N/A N/A type e __name__ N/A N/A assertion None N/A N/A N/A N/A N/A assertion target N/A N/A N/A Exception N/A e N/A N/A N/A N/A name N/A i 1 field value N/A N/A type e __name__ N/A