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

Class Try

A try statement

Import path

import python

Direct supertypes

Indirect supertypes

Predicates

getAGroupHandler

Gets a group exception handler, except*, of this try statement.

getAHandler

Gets an exception handler of this try statement.

getANormalHandler

Gets a normal exception handler, except, of this try statement.

getASubExpression

Gets an immediate (non-nested) sub-expression of this statement

getASubStatement

Gets an immediate (non-nested) sub-statement of this statement

getHandler

Gets the nth exception handler of this try statement.

getLastStatement

Gets the final statement in this statement, ordered by location. Will be this statement if not a compound statement.

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

from Stmt
getAFinalstmt

Gets a finally statement of this try statement.

from Try_
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
getAStmt

Gets a statement of this try statement.

from Try_
getASubPattern

Gets an immediate (non-nested) sub-pattern of this statement

from Stmt
getAnEntryNode

Gets a control flow node for an entry into this statement.

from Stmt
getAnOrelse

Gets an else statement of this try statement.

from Try_
getBody

Gets the body of this try statement.

from Try_
getEnclosingModule

Gets the module enclosing this statement

from Stmt
getFinalbody

Gets the finally block of this try statement.

from Try_
getFinalstmt

Gets the nth finally statement of this try statement.

from Try_
getHandlers

Gets the exception handlers of this try statement.

from Try_
getLocationfrom Stmt
getOrelse

Gets the else block of this try statement.

from Try_
getOrelse

Gets the nth else statement of this try statement.

from Try_
getParent

Gets a parent of this statement

from Stmt_
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
getScope

Gets the scope immediately enclosing this statement

from Stmt
getStmt

Gets the nth statement of this try statement.

from Try_
isArtificial

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

from AstNode
isUnreachable

Holds if this statement cannot be reached

from Stmt
toStringfrom Try_