CodeQL library for Python
Search

Module ObjectAPI

Public API for “objects” A Value is a static approximation to a set of runtime objects.

Import path

import semmle.python.objects.ObjectAPI

Imports

Classes

BoundMethodValue

Class representing bound-methods, such as o.func, where o is an instance of a class that has a callable attribute func.

BuiltinFunctionValue

Class representing builtin functions, such as len or print

BuiltinMethodValue

Class representing builtin methods, such as list.append or set.add

CallableValue

Class representing callables in the Python program Callables include Python functions, built-in functions and bound-methods, but not classes.

ClassValue

Class representing classes in the Python program, both Python and built-in.

FunctionValue

Class representing functions in the Python program, both Python and built-in. Note that this does not include other callables such as bound-methods.

MRO

A method-resolution-order sequence of classes

ModuleValue

Class representing modules in the Python program Each ModuleValue represents a module object in the Python program.

NumericValue

A class representing numbers (ints and floats), either present in the source as a literal, or in a builtin as a value.

PropertyValue

A Python property:

PythonFunctionValue

Class representing Python functions

SequenceValue

A class representing sequence objects with a length and tracked items.

StringValue

A class representing strings, either present in the source as a literal, or in a builtin as a value.

TupleValue

A class representing tuple objects

Value

Class representing values in the Python program Each Value is a static approximation to a set of one or more real objects.

Modules

Aliases

ClassScope

The scope of a class. This is the scope of all the statements within the class definition

FunctionScope

A function, independent of defaults and binding. It is the syntactic entity that is compiled to a code object.

ModuleScope

A module. This is the top level element in an AST, corresponding to a source file. It is also a Scope; the scope of global variables.

ObjectSource

Instances of this class represent objects in the Python program. However, since the QL database is static and Python programs are dynamic, there are necessarily a number of approximations.