Class Class::Class

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

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

contains

Whether this contains inner syntactically

containsInScope

Whether this contains inner syntactically and inner has the same scope as this

getABase

Gets a base of this class definition.

getAChildNode

Gets a child node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt().

getADecorator
getAMethod

Gets a method defined in this class

getAStmt

Gets a statement in the class

getBase

Gets the nth base of this class definition.

getBody

Gets the statements forming the body of this class

getClassObject

Gets the ClassObject corresponding to this class

getDefinition

Use getADecorator() instead of getDefinition().getADecorator() Use getMetaClass() instead of getDefinition().getMetaClass()

getEnclosingScope

Gets the scope (module, class or function) in which this class is defined

getInitMethod

Gets a defined init method of this class

getLocation

Gets the location for this AST node

getMetaClass

Gets the metaclass expression

getMetrics

Gets the metrics for this class

getName

Gets the name used to define 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

Use getEnclosingScope() instead

getStmt

Gets the nth statement in the class

hasSideEffects
isProbableMixin

Whether this is probably a mixin (has ‘mixin’ or similar in name or docstring)

toString

Inherited predicates

getAFlowNode

Gets a flow node corresponding directly to this node. NOTE: For some statements and other purely syntactic elements, there may not be a ControlFlowNode

from AstNode
getANormalExit

Gets an exit from this Scope’s control flow graph, that does not result from an exception

from Scope
getAnExitNode

Gets an exit from this Scope’s control flow graph

from Scope
getDocString

Gets the docstring for this scope

from Scope
getEnclosingModulefrom Scope
getEntryNode

Gets the entry point into this Scope’s control flow graph

from Scope
getEvaluatingScope

Gets the evaluation scope for code in this (lexical) scope. This is usually the scope itself, but may be an enclosing scope. Notably, for list comprehensions in Python 2.

from Scope
getFallthroughNode

Gets the non-explicit exit from this Scope’s control flow graph

from Scope
getLastStatementfrom Scope
getParentfrom Class_
getParentNode

Gets the parent node of this node in the AST. This predicate exists to aid exploration of the AST and other experiments. The child-parent relation may not be meaningful. For a more meaningful relation in terms of dependency use Expr.getASubExpression(), Stmt.getASubStatement(), Stmt.getASubExpression() or Scope.getAStmt() applied to the parent.

from AstNode
getReturnNode

Gets the exit of this scope following from a return statement

from Scope
inSource

Holds if this scope is in the source archive, that is it is part of the code specified, not library code

from Scope
isArtificial

Whether this syntactic element is artificial, that is it is generated by the compiler and is not present in the source

from AstNode
isPublic

Holds if this scope is deemed to be public

from Scope
isTopLevel

Holds if this a top-level (non-nested) class or function

from Scope
precedes

Holds if this scope can be expected to execute before other. Modules precede functions and methods in those modules __init__ precedes other methods. __enter__ precedes __exit__. NOTE that this is context-insensitive, so a module “precedes” a function in that module, even if that function is called from the module scope.

from Scope