module testing.verify_code
#
Short summary#
module mlprodict.testing.verify_code
Looks into the code and detects error before finalizing the benchmark.
Classes#
class |
truncated documentation |
---|---|
Visits the code, implements verification rules. |
|
Raised if the code shows errors. |
Functions#
function |
truncated documentation |
---|---|
Verifies python code. |
Properties#
property |
truncated documentation |
---|---|
returns a list of dictionaries with all the elements of the code |
Static Methods#
staticmethod |
truncated documentation |
---|---|
Debugging purpose. |
Methods#
method |
truncated documentation |
---|---|
Overrides |
|
Overrides |
|
Displays the tree of instructions. |
|
Pushes an element into a list. |
|
Visits a node, a method must exist for every object class. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Documentation#
Looks into the code and detects error before finalizing the benchmark.
- class mlprodict.testing.verify_code.CodeNodeVisitor#
Bases:
NodeVisitor
Visits the code, implements verification rules.
- property Rows#
returns a list of dictionaries with all the elements of the code
- __init__()#
- generic_visit(node)#
Overrides
generic_visit
to check it is not used.
- generic_visit_args(node, row)#
Overrides
generic_visit
to keep track of the indentation and the node parent. The function will add fieldrow["children"] = visited
nodes from here.- Parameters:
node – node which needs to be visited
row – row (a dictionary)
- Returns:
See
ast.NodeVisitor.generic_visit
- static print_node(node)#
Debugging purpose.
- print_tree()#
Displays the tree of instructions.
- Returns:
string
- push(row)#
Pushes an element into a list.
- visit(node)#
Visits a node, a method must exist for every object class.
- exception mlprodict.testing.verify_code.ImperfectPythonCode#
Bases:
RuntimeError
Raised if the code shows errors.
- mlprodict.testing.verify_code.verify_code(source, exc=True)#
Verifies python code.
- Parameters:
source – source to look into
exc – raise an exception or return the list of missing identifiers
- Returns:
tuple(missing identifiers,
CodeNodeVisitor
)