CodeQL library for Python
codeql/python-all 1.0.5-dev (changelog, source)
Search

Class Comprehension

A comprehension part, the ‘for a in seq’ part of [ a * a for a in seq ]

Import path

import python

Direct supertypes

Indirect supertypes

Predicates

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().

getASubExpression
getLocation
getScope

Gets the scope of this comprehension

toString

Inherited predicates

contains

Whether this contains inner syntactically

from AstNode
containsInScope

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

from AstNode
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
getAnIf

Gets a condition of this comprehension.

from Comprehension_
getIf

Gets the nth condition of this comprehension.

from Comprehension_
getIfs

Gets the conditions of this comprehension.

from Comprehension_
getIter

Gets the iterable of this comprehension.

from Comprehension_
getParent

Gets a parent of this comprehension

from Comprehension_
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
getTarget

Gets the target of this comprehension.

from Comprehension_
isArtificial

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

from AstNode