mate_query.cpg.models.core.node module

Core node models and functions.

At runtime, the models here are accessed via attributes on a CPG, not directly.

class mate_query.cpg.models.core.node.BaseNode

Bases: mate_query.cpg.models.core.base.Base

classmethod edge_relationship(edge_kind: EdgeKind, other: Type[Node], direction: Optional[Direction] = None, **kwargs: Any) RelationshipProperty
Parameters
Return type

RelationshipProperty

classmethod from_dirpath(dirpath: str) List[Node]

Returns Nodes whose debug symbols contain a filepath that includes the given dirpath.

Parameters

dirpath (str) –

Return type

List[Node]

classmethod from_filename_line_no(filepath: str, line_no: Optional[int] = None) Node

Returns Nodes whose debug symbols contain the given filepath, or the matching filepath and line number.

Parameters
  • filepath (str) –

  • line_no (Optional[int]) –

Return type

Node

kind = Column('kind', Enum('Function', 'Block', 'MemoryLocation', 'UnclassifiedNode', 'LLVMType', 'Variable', 'Argument', 'LocalVariable', 'ParamBinding', 'CallReturn', 'GlobalVariable', 'Module', 'TranslationUnit', 'Instruction', 'Alloca', 'Call', 'Load', 'Invoke', 'Resume', 'Ret', 'Store', 'Memcpy', 'Memset', 'Constant', 'ConstantFP', 'ConstantInt', 'ConstantUndef', 'ConstantString', 'ASMGlobalVariable', 'MachineBasicBlock', 'MachineFunction', 'MachineInstr', 'ASMBlock', 'ASMInst', 'PLTStub', 'VTable', 'DWARFType', 'BasicType', 'CompositeType', 'CompositeCachedType', 'StructureType', 'ArrayType', 'EnumType', 'UnionType', 'ClassType', 'DerivedType', 'SubroutineType', 'DWARFLocalVariable', 'DWARFArgument', 'DataflowSignature', 'InputSignature', 'OutputSignature', name='nodekind'), table=None, nullable=False)
property location_string: str

Return a human-readable source location string for this node.

provenance
class mate_query.cpg.models.core.node.Node(uuid: str, kind: NodeKind, attributes: Dict[str, Any] = {})

Bases: mate_query.cpg.models.core.node.BaseNode

Parameters
  • uuid (str) –

  • kind (NodeKind) –

  • attributes (Dict[str, Any]) –

mate_query.cpg.models.core.node.node_kind_column() sqlalchemy.sql.schema.Column
Return type

sqlalchemy.sql.schema.Column