Skip to content

Commit 682e1b6

Browse files
committed
Python: Document Comparisons.qll.
1 parent b8e744e commit 682e1b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

python/ql/src/semmle/python/Comparisons.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing comparison operators.
3+
*/
4+
15
import python
26

37
/** A class representing the six comparison operators, ==, !=, <, <=, > and >=. */
@@ -34,6 +38,7 @@ class CompareOp extends int {
3438
this = ge() and result = le()
3539
}
3640

41+
/** Gets the textual representation of `this`. */
3742
string repr() {
3843
this = eq() and result = "=="
3944
or
@@ -48,6 +53,7 @@ class CompareOp extends int {
4853
this = ge() and result = ">="
4954
}
5055

56+
/** Holds if `op` is the `Cmpop` corresponding to `this`. */
5157
predicate forOp(Cmpop op) {
5258
op instanceof Eq and this = eq()
5359
or
@@ -70,16 +76,22 @@ class CompareOp extends int {
7076
}
7177
}
7278

79+
/** The `CompareOp` for "equals". */
7380
CompareOp eq() { result = 1 }
7481

82+
/** The `CompareOp` for "not equals". */
7583
CompareOp ne() { result = 2 }
7684

85+
/** The `CompareOp` for "less than". */
7786
CompareOp lt() { result = 3 }
7887

88+
/** The `CompareOp` for "less than or equal to". */
7989
CompareOp le() { result = 4 }
8090

91+
/** The `CompareOp` for "greater than". */
8192
CompareOp gt() { result = 5 }
8293

94+
/** The `CompareOp` for "greater than or equal to". */
8395
CompareOp ge() { result = 6 }
8496

8597
/* Workaround precision limits in floating point numbers */

0 commit comments

Comments
 (0)