topos.graphs.cpg.object

CodePropertyGraph Representation.

Implements the Representation protocol on the SECURE generator.

class topos.graphs.cpg.object.CodePropertyGraph(nodes=<factory>, edges=<factory>, language='python', source='')[source]

Bases: object

A Code Property Graph (Yamaguchi et al., arxiv:1909.03496).

nodes

UAST nodes keyed by stable id.

Type:

dict[str, topos.graphs.cpg.models.CPGNode]

edges

Labeled CPG edges across the four families {AST, CFG, DDG, CDG}.

Type:

list[topos.graphs.cpg.models.CPGEdge]

language

The source language (passed through for danger-registry lookup).

Type:

str

nodes
edges
language = 'python'
source = ''
property name
property dimension
classmethod from_uast(uast_root, source='')[source]
node_text(node)[source]

Slice the original source by a node’s byte span.

nodes_of_kind(kind)[source]
metrics()[source]