From 03cd914381de3fbcd9dbfe228a569fab6a6d62a9 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Fri, 18 Feb 2022 19:04:42 +0300 Subject: [PATCH] pylint: Skip use-implicit-booleaness-not-comparison Pylint 2.12.0 introduced new checker: > Used when Pylint detects that collection literal comparison is being used to check for emptiness; Use implicit booleaness insteadof a collection classes; empty collections are considered as false Comparison of variable to equality to collection: > Lexicographical comparison between built-in collections works as follows: For two collections to compare equal, they must be of the same type, have the same length, and each pair of corresponding elements must compare equal (for example, [1,2] == (1,2) is false because the type is not the same). Collections that support order comparison are ordered the same as their first unequal elements (for example, [1,2,x] <= [1,2,y] has the same value as x <= y). If a corresponding element does not exist, the shorter collection is ordered first (for example, [1,2] < [1,2,3] is true). So, `assert value == {}` is not the same as `assert not value`. Fixes: https://pagure.io/freeipa/issue/9117 Signed-off-by: Stanislav Levin Reviewed-By: Rob Crittenden --- pylintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/pylintrc b/pylintrc index 074ead298..4755e1ba0 100644 --- a/pylintrc +++ b/pylintrc @@ -121,6 +121,7 @@ disable= use-dict-literal, # pylint 2.10.0 dict vs {} use-list-literal, # pylint 2.10.0 list() vs [] unspecified-encoding, # pylint 2.10.0, ASCII or UTF8 and platform-specific + use-implicit-booleaness-not-comparison, # pylint 2.12.2, weak comparison [REPORTS]