Fix pylint 2.0 conditional-related violations

In order to support pylint 2.0 the following violations must be fixed:

- `chained-comparison` (R1716):
  Simplify chained comparison between the operands This message is
  emitted when pylint encounters boolean operation like
  "a < b and b < c", suggesting instead to refactor it to "a < b < c".

- `consider-using-in` (R1714):
  Consider merging these comparisons with "in" to %r To check if a
  variable is equal to one of many values,combine the values into a
  tuple and check if the variable is contained "in" it instead of
  checking for equality against each of the values.This is faster
  and less verbose.

Issue: https://pagure.io/freeipa/issue/7614

Signed-off-by: Armando Neto <abiagion@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Armando Neto
2018-07-11 17:30:12 -03:00
committed by Christian Heimes
parent f48f00c692
commit ba954efafd
9 changed files with 12 additions and 12 deletions

View File

@@ -113,10 +113,10 @@ class ACI(object):
if token == "(":
var = next(lexer).strip()
operator = next(lexer)
if operator != "=" and operator != "!=":
if operator not in ("=", "!="):
# Peek at the next char before giving up
operator = operator + next(lexer)
if operator != "=" and operator != "!=":
if operator not in ("=", "!="):
raise SyntaxError("No operator in target, got '%s'" % operator)
op = operator
val = next(lexer).strip()