CodeQL library for Python
Search

Module Comparisons

Provides classes representing comparison operators.

Import path

import semmle.python.Comparisons

Imports

Predicates

eq

The CompareOp for “equals”.

ge

The CompareOp for “greater than or equal to”.

gt

The CompareOp for “greater than”.

le

The CompareOp for “less than or equal to”.

lt

The CompareOp for “less than”.

ne

The CompareOp for “not equals”.

Classes

CompareOp

A class representing the six comparison operators, ==, !=, <, <=, > and >=.

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 !=.

ComparisonControlBlock

A basic block which terminates in a condition, splitting the subsequent control flow, in which the condition is an instance of Comparison