Documentation
¶
Overview ¶
Package python implements the Python language analyzer for semantic input tracing
Index ¶
- type PythonAnalyzer
- func (a *PythonAnalyzer) AnalyzeMethodBody(method *types.MethodDef, source []byte, state *types.AnalysisState) (*analyzer.MethodFlowAnalysis, error)
- func (a *PythonAnalyzer) BuildSymbolTable(filePath string, source []byte, root *sitter.Node) (*types.SymbolTable, error)
- func (a *PythonAnalyzer) DetectFrameworks(symbolTable *types.SymbolTable, source []byte) ([]string, error)
- func (a *PythonAnalyzer) ExtractAssignments(root *sitter.Node, source []byte, scope string) ([]*types.Assignment, error)
- func (a *PythonAnalyzer) ExtractCalls(root *sitter.Node, source []byte, scope string) ([]*types.CallSite, error)
- func (a *PythonAnalyzer) ExtractClasses(root *sitter.Node, source []byte) ([]*types.ClassDef, error)
- func (a *PythonAnalyzer) ExtractFunctions(root *sitter.Node, source []byte) ([]*types.FunctionDef, error)
- func (a *PythonAnalyzer) FindInputSources(root *sitter.Node, source []byte) ([]*types.FlowNode, error)
- func (a *PythonAnalyzer) ResolveImports(symbolTable *types.SymbolTable, basePath string) ([]string, error)
- func (a *PythonAnalyzer) TraceExpression(target types.FlowTarget, state *types.AnalysisState) (*types.FlowMap, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PythonAnalyzer ¶
type PythonAnalyzer struct {
*analyzer.BaseAnalyzer
// contains filtered or unexported fields
}
PythonAnalyzer implements the LanguageAnalyzer interface for Python
func NewPythonAnalyzer ¶
func NewPythonAnalyzer() *PythonAnalyzer
NewPythonAnalyzer creates a new Python analyzer
func (*PythonAnalyzer) AnalyzeMethodBody ¶
func (a *PythonAnalyzer) AnalyzeMethodBody(method *types.MethodDef, source []byte, state *types.AnalysisState) (*analyzer.MethodFlowAnalysis, error)
AnalyzeMethodBody analyzes a method body for data flow
func (*PythonAnalyzer) BuildSymbolTable ¶
func (a *PythonAnalyzer) BuildSymbolTable(filePath string, source []byte, root *sitter.Node) (*types.SymbolTable, error)
BuildSymbolTable builds the symbol table for a Python file
func (*PythonAnalyzer) DetectFrameworks ¶
func (a *PythonAnalyzer) DetectFrameworks(symbolTable *types.SymbolTable, source []byte) ([]string, error)
DetectFrameworks detects which Python frameworks are being used
func (*PythonAnalyzer) ExtractAssignments ¶
func (a *PythonAnalyzer) ExtractAssignments(root *sitter.Node, source []byte, scope string) ([]*types.Assignment, error)
ExtractAssignments extracts all assignments from the AST
func (*PythonAnalyzer) ExtractCalls ¶
func (a *PythonAnalyzer) ExtractCalls(root *sitter.Node, source []byte, scope string) ([]*types.CallSite, error)
ExtractCalls extracts all function/method calls from the AST
func (*PythonAnalyzer) ExtractClasses ¶
func (a *PythonAnalyzer) ExtractClasses(root *sitter.Node, source []byte) ([]*types.ClassDef, error)
ExtractClasses extracts class definitions from Python AST
func (*PythonAnalyzer) ExtractFunctions ¶
func (a *PythonAnalyzer) ExtractFunctions(root *sitter.Node, source []byte) ([]*types.FunctionDef, error)
ExtractFunctions extracts standalone function definitions
func (*PythonAnalyzer) FindInputSources ¶
func (a *PythonAnalyzer) FindInputSources(root *sitter.Node, source []byte) ([]*types.FlowNode, error)
FindInputSources finds all user input sources in the AST
func (*PythonAnalyzer) ResolveImports ¶
func (a *PythonAnalyzer) ResolveImports(symbolTable *types.SymbolTable, basePath string) ([]string, error)
ResolveImports resolves import paths to actual file paths
func (*PythonAnalyzer) TraceExpression ¶
func (a *PythonAnalyzer) TraceExpression(target types.FlowTarget, state *types.AnalysisState) (*types.FlowMap, error)
TraceExpression traces a specific expression back to its sources