Skip to content

Commit f784bb0

Browse files
Fix qldoc errors + typos
1 parent 61af4e4 commit f784bb0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

python/ql/src/Classes/Comparisons/EqualsOrNotEquals.qhelp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ then the <code>!=</code> operator will automatically delegate to the <code>__eq_
1414
<p>However, if the <code>__ne__</code> method is defined without a corresponding <code>__eq__</code> method,
1515
the <code>==</code> operator will still default to object identity (equivalent to the <code>is</code> operator), while the <code>!=</code>
1616
operator will use the <code>__ne__</code> method, which may be inconsistent.
17+
</p>
1718

18-
<p>Additionally, if the <code>__ne__</code> method is defined on a superclass, and the subclass defines its own <cde>__eq__</code> method without overriding
19+
<p>Additionally, if the <code>__ne__</code> method is defined on a superclass, and the subclass defines its own <code>__eq__</code> method without overriding
1920
the superclass <code>__ne__</code> method, the <code>!=</code> operator will use this superclass <code>__ne__</code> method, rather than automatically delegating
2021
to <code>__eq__</code>, which may be incorrect.
22+
</p>
2123

2224
</overview>
2325
<recommendation>

python/ql/src/Classes/Comparisons/examples/EqualsOrNotEquals2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __ne__(self, other):
1010

1111
class C(B):
1212
def __init__(self, b, c):
13-
super().init(b)
13+
super().__init__(b)
1414
self.c = c
1515

1616
# BAD: eq is defined, but != will use superclass ne method, which is not consistent

python/ql/src/Classes/Comparisons/examples/IncompleteOrdering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class A:
22
def __init__(self, i):
33
self.i = i
44

5-
# BAD: le is not defined, so `A(1) <= A(2) would result in an error.`
5+
# BAD: le is not defined, so `A(1) <= A(2)` would result in an error.
66
def __lt__(self, other):
77
return self.i < other.i
88

python/ql/test/query-tests/Classes/equals-hash/equalsHash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class A:
22
def __eq__(self, other):
33
return True
44

5-
def __hash__(self, other):
5+
def __hash__(self):
66
return 7
77

88
# B is automatically non-hashable - so eq without hash never needs to alert

0 commit comments

Comments
 (0)