Class ClassValue

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

Import path

import python

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

declaredAttribute

Gets the attribute declared in this class

declaresAttribute

Holds if this class declares the attribute name, not including attributes declared by super classes.

failedInference
getABaseType

Gets an immediate base type of this class.

getASuperType

Gets an improper super type of this class.

getBaseType

Gets the nth immediate base type of this class.

getMro

Gets the MRO for this class

getQualifiedName

Gets the qualified name for this class. Should return the same name as the __qualname__ attribute on classes in Python 3.

getScope

Gets the scope associated with this class, if it is not a builtin class

hasAttribute

Holds if this class has the attribute name, including attributes declared by super classes.

isCallable
isContainer

Holds if this class is a container(). That is, does it have a getitem method.

isContextManager

Holds if this class is a context manager.

isDescriptorType

Holds if this class is a descriptor.

isIterable

Holds if this class is an iterable.

isIterator

Holds if this class is an iterator.

isLegalExceptionType

Whether this class is a legal exception class. What constitutes a legal exception class differs between major versions

isMapping

Holds if this class is a mapping. Mutually exclusive with isSequence().

isNewStyle

Holds if this class is a new style class. A new style class is one that implicitly or explicitly inherits from object.

isOldStyle

Holds if this class is an old style class. An old style class is one that does not inherit from object.

isSequence

Holds if this class is a sequence. Mutually exclusive with isMapping().

lookup

Looks up the attribute name on this class. Note that this may be different from this.attr(name). For example given the class: class C: @classmethod def f(cls): pass this.lookup("f") is equivalent to C.__dict__['f'], which is the class-method whereas this.attr("f") is equivalent to C.f, which is a bound-method.

Inherited predicates

attr

Gets a Value that represents the attribute name of this object.

from Value
getABooleanValue

Gets the boolean interpretation of this value. Could be both true and false, if we can’t determine the result more precisely.

from Value
getACall

Gets a call to this object

from Value
getACall

Gets a call to this object with the given caller context.

from Value
getAReference

Gets a ControlFlowNode that refers to this object.

from Value
getClass

Gets the class of this object. Strictly, the Value representing the class of the objects represented by this Value.

from Value
getDefiniteBooleanValue

Gets the boolean interpretation of this value, only if we can determine the result precisely. The result can be none(), but never both true and false.

from Value
getName

Gets the name of this value, if it has one. Note this is the innate name of the object, not necessarily all the names by which it can be called.

from Value
getOrigin

Gets the origin CFG node for this value.

from Value
hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

from Value
isAbsent

Whether this value is absent from the database, but has been inferred to likely exist

from Value
isBuiltin

Holds if this value is builtin. Applies to built-in functions and methods, but also integers and strings.

from Value
overrides

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

from Value
toString

Gets a textual representation of this element.

from Value

Charpred