class documentation

class Heuristics: (source)

View In Hierarchy

A set of heuristic function for assisting type inference

Static Method get_bin_op_involved Get list of variables/constants/callables involved in a binary operation
Static Method heuristic_eight Performs heuristic 8 for a function's inputs. Note that this heuristic attempts to infer/check the types a developer likely intended for function parameters and provide a limited number of types to the actual number that may work...
Static Method heuristic_nine No summary
Static Method heuristic_seven No summary
Static Method heuristic_six No summary
Static Method heuristic_twelve Performs heuristic 8 for a function's inputs. Note that this heuristic attempts to infer/check the types a developer likely intended for function parameters and provide a limited number of types to the actual number that may work...
Static Method heuristic_two No summary
Static Method in_bin_op Determines whether a variable is featured in a binary operation
Method heuristic_eleven Undocumented
Method heuristic_five No summary
Method heuristic_five_return Undocumented
@staticmethod
def get_bin_op_involved(binary_operation: ast.BinOp): (source)

Get list of variables/constants/callables involved in a binary operation

Parameters
binary_operation:ast.BinOpthe binary operation to get the names for
Returns
Listlist of variable/constants/callables
@staticmethod
def heuristic_eight(ast_tree, function_name, function_params): (source)

Performs heuristic 8 for a function's inputs. Note that this heuristic attempts to infer/check the types a developer likely intended for function parameters and provide a limited number of types to the actual number that may work

Parameters
ast_treeThe ast tree for the module the function is in
function_nameThe name of the function being checked
function_paramsThe function parameters from a variable assignment map
@staticmethod
def heuristic_nine(import_mappings, processed_file, function_node): (source)
Parameters
import_mappingsThe import mappings that have been generated
processed_fileThe files that have been processed
function_nodeThe function node being checked
@staticmethod
def heuristic_seven(processed_file, function_node): (source)
Parameters
processed_filethe files that have been processed
function_nodethe function node being checked
@staticmethod
def heuristic_six(processed_file, function_node): (source)
Parameters
processed_filethe files that have been processed
function_nodethe function node being checked
@staticmethod
def heuristic_twelve(function_node, function_params): (source)

Performs heuristic 8 for a function's inputs. Note that this heuristic attempts to infer/check the types a developer likely intended for function parameters and provide a limited number of types to the actual number that may work

Parameters
function_nodeUndocumented
function_paramsThe function parameters from a variable assignment map
ast_treeThe ast tree for the module the function is in
function_nameThe name of the function being checked
@staticmethod
def heuristic_two(ast_tree, processed_file, assignments): (source)
Parameters
ast_treethe root node of the ast tree
processed_filethe files that have been processed
assignmentsthe assignment list
@staticmethod
def in_bin_op(variable: ScalpelVariable, binary_operation: ast.BinOp): (source)

Determines whether a variable is featured in a binary operation

Parameters
variable:ScalpelVariableThe variable to check for
binary_operation:ast.BinOpThe binary operation to check
Returns
BooleanTrue if it is within the binary operation, false otherwise
def heuristic_eleven(self, processed_file, function_node): (source)

Undocumented

def heuristic_five(self, import_mappings, processed_file, function_node): (source)
Parameters
import_mappingsthe import mappings that have been generated
processed_filethe files that have been processed
function_nodethe function node being checked
def heuristic_five_return(self, assignments, return_node: ast.BinOp): (source)

Undocumented