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

Class Comparison

A comparison which can be simplified to the canonical form x OP y + k where x and y are ControlFlowNodes, k is a floating point constant and OP is one of <=, >, == or !=.

Import path

import semmle.python.Comparisons

Direct supertypes

Indirect supertypes

Predicates

impliesThat

Whether the result of this comparison being thisIsTrue implies that the result of that is isThatTrue. In other words, does the predicate that is equivalent to the result of this being thisIsTrue imply the predicate that is equivalent to the result of that being thatIsTrue. For example, assume that there are two tests, which when normalised have the form x < y and x > y + 1. Then the test x < y having a true result, implies that the test x > y + 1 will have a false result. (x < y having a false result implies nothing about x > y + 1)

tests

Whether this condition tests l op k

tests

Whether this condition tests l op r + k

Inherited predicates

dominates

Whether this dominates other. Note that all nodes dominate themselves.

from ControlFlowNode
getAChildfrom ControlFlowNode
getAFalseSuccessor

Gets a successor for this node if the relevant condition is False.

from ControlFlowNode
getANormalSuccessor

Gets a successor for this node if no exception is raised.

from ControlFlowNode
getAPredecessor

Gets a predecessor of this flow node

from ControlFlowNode
getASuccessor

Gets a successor of this flow node

from ControlFlowNode
getATrueSuccessor

Gets a successor for this node if the relevant condition is True.

from ControlFlowNode
getAnExceptionalSuccessor

Gets a successor for this node if an exception is raised.

from ControlFlowNode
getBasicBlock

Gets the basic block containing this flow node

from ControlFlowNode
getEnclosingModule

Gets the enclosing module

from ControlFlowNode
getImmediateDominator

Gets the immediate dominator of this flow node

from ControlFlowNode
getLocation

Gets the location of this ControlFlowNode

from ControlFlowNode
getNode

Gets the syntactic element corresponding to this flow node

from ControlFlowNode
getScope

Gets the scope containing this flow node

from ControlFlowNode
hasCompletePointsToSet

Check whether this control-flow node has complete points-to information. This would mean that the analysis managed to infer an over approximation of possible values at runtime.

from ControlFlowNode
inferredValue

Gets a value that this ControlFlowNode may points-to.

from ControlFlowNode
isAttribute

Whether this flow node corresponds to an attribute expression

from ControlFlowNode
isAugLoad

Whether this control flow node is a load in an augmented assignment

from ControlFlowNode
isAugStore

Whether this control flow node is a store in an augmented assignment

from ControlFlowNode
isBranch

Holds if this CFG node is a branch

from ControlFlowNode
isCall

Whether this flow node corresponds to a call

from ControlFlowNode
isClass

Whether this flow node corresponds to a class definition expression

from ControlFlowNode
isDelete

Whether this control flow node is a delete

from ControlFlowNode
isEntryNode

Whether this flow node is the first in its scope

from ControlFlowNode
isExceptionalExit

Whether the scope may be exited as a result of this node raising an exception

from ControlFlowNode
isFunction

Whether this flow node corresponds to a function definition expression

from ControlFlowNode
isIfExp

Whether this flow node corresponds to a conditional expression

from ControlFlowNode
isImport

Whether this flow node corresponds to an import

from ControlFlowNode
isImportMember

Whether this flow node corresponds to an import member

from ControlFlowNode
isLiteral

Whether this flow node corresponds to a literal

from ControlFlowNode
isLoad

Whether this control flow node is a load (including those in augmented assignments)

from ControlFlowNode
isModuleEntry

Whether this flow node is the first in a module

from ControlFlowNode
isNormalExit

Whether this node is a normal (non-exceptional) exit

from ControlFlowNode
isParameter

Whether this control flow node is a parameter

from ControlFlowNode
isStore

Whether this control flow node is a store (including those in augmented assignments)

from ControlFlowNode
isSubscript

Whether this flow node corresponds to an subscript expression

from ControlFlowNode
pointsTo

Gets the value that this ControlFlowNode points-to.

from ControlFlowNode
pointsTo

Gets the value that this ControlFlowNode points-to.

from ControlFlowNode
pointsTo

Gets the value and origin that this ControlFlowNode points-to.

from ControlFlowNode
pointsTo

Gets the value and origin that this ControlFlowNode points-to, given the context.

from ControlFlowNode
refersTo

Equivalent to this.refersTo(value, _)

from ControlFlowNode
refersTo

Whether this flow node might “refer-to” to value which is from origin Unlike this.refersTo(value, _, origin) this predicate includes results where the class cannot be inferred.

from ControlFlowNode
refersTo

Gets what this flow node might “refer-to”. Performs a combination of localized (intra-procedural) points-to analysis and global module-level analysis. This points-to analysis favours precision over recall. It is highly precise, but may not provide information for a significant number of flow-nodes. If the class is unimportant then use refersTo(value) or refersTo(value, origin) instead.

from ControlFlowNode
refersTo

Gets what this expression might “refer-to” in the given context.

from ControlFlowNode
strictlyDominates

Whether this strictly dominates other.

from ControlFlowNode
strictlyReaches

Whether this strictly reaches other.

from ControlFlowNode
toString

Gets a textual representation of this element.

from ControlFlowNode
unlikelyReachable

Whether it is unlikely that this ControlFlowNode can be reached

from ControlFlowNode

Charpred