Method: pylint.checkers.utils.get_inverse_comparator
Calls: 53, Exceptions: 0, Paths: 1Back
Path 1: 53 calls (1.0)
'==' (19) '!=' (7) 'is' (6) '<' (5) 'is not' (4) '<=' (3) '>' (3) 'not in' (2) 'in' (2) '>=' (2)
'!=' (19) '==' (7) 'is not' (6) '>=' (5) 'is' (4) '>' (3) '<=' (3) 'in' (2) 'not in' (2) '<' (2)
1def get_inverse_comparator(op: str) -> str:
2 """Returns the inverse comparator given a comparator.
3
4 E.g. when given "==", returns "!="
5
6 :param str op: the comparator to look up.
7
8 :returns: The inverse of the comparator in string format
9 :raises KeyError: if input is not recognized as a comparator
10 """
11 return {
12 "==": "!=",
13 "!=": "==",
14 "<": ">=",
15 ">": "<=",
16 "<=": ">",
17 ">=": "<",
18 "in": "not in",
19 "not in": "in",
20 "is": "is not",
21 "is not": "is",
22 }[op]