Class Object::Object

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.

Each point in the control flow graph where a new object can be created is treated as an object. Many builtin objects, such as integers, strings and builtin classes, are also treated as ‘objects’. Hence each ‘object’, that is an instance of this class, represents a set of actual Python objects in the actual program.

Ideally each set would contain only one member, but that is not possible in practice. Many instances of this class will represent many actual Python objects, especially if the point in the control flow graph to which they refer is in a loop. Others may not refer to any objects. However, for many important objects such as classes and functions, there is a one-to-one relation.

Direct supertypes

Known direct subtypes

Predicates

booleanValue

The Boolean value of this object if it always evaluates to true or false. For example: false for None, true for 7 and no result for int(x)

getAnInferredType

Gets an inferred type for this object, without using inter-procedural analysis. WARNING: The lack of context makes this less accurate than f.refersTo(this, result, _) for a control flow node ‘f’

getOrigin

Gets the point in the source code from which this object “originates”.

hasLocationInfo
hasLongName

Holds if this object can be referred to by longName For example, the modules dict in the sys module has the long name sys.modules and the name os.path.join will refer to the path joining function even though it might be declared in the posix or nt modules. Long names can have no more than three dots after the module name.

isBuiltin

Whether this a builtin object. A builtin object is one defined by the implementation, such as the integer 4 or by a native extension, such as a NumPy array class.

isC

Retained for backwards compatibility. See Object.isBuiltin()

overrides

Whether this overrides o. In this context, “overrides” means that this object is a named attribute of a some class C and o is a named attribute of another class S, both attributes having the same name, and S is a super class of C.

simpleClass

Gets the class of this object for simple cases, namely constants, functions, comprehensions and built-in objects.

toString

Charpred