From bf4c0bc96ac9d48c0eca960edeb443dda814afbe Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 20 Sep 2021 16:33:47 +0200 Subject: [PATCH 26/59] misc: fix simplifiable-if-statement pylint error (#56982) --- src/authentic2/disco_service/disco_responder.py | 5 +---- src/authentic2/saml/x509utils.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/authentic2/disco_service/disco_responder.py b/src/authentic2/disco_service/disco_responder.py index 42df7acc..4d0e5504 100644 --- a/src/authentic2/disco_service/disco_responder.py +++ b/src/authentic2/disco_service/disco_responder.py @@ -172,10 +172,7 @@ def disco(request): returnIDParam = request.GET.get('returnIDParam', 'entityID') # XXX: isPassive is unused isPassive = request.GET.get('isPassive', '') - if isPassive and isPassive == 'true': - isPassive = True - else: - isPassive = False + isPassive = bool(isPassive == 'true') if not entityID: message = _('missing mandatory parameter entityID') diff --git a/src/authentic2/saml/x509utils.py b/src/authentic2/saml/x509utils.py index ffbe85ac..8196e7d8 100644 --- a/src/authentic2/saml/x509utils.py +++ b/src/authentic2/saml/x509utils.py @@ -82,10 +82,7 @@ def check_key_pair_consistency(publickey=None, privatekey=None): if rc2 != 0: rc2, modulus2 = _call_openssl(['dsa', '-in', privatekey_file.name, '-noout', '-modulus']) - if rc1 == 0 and rc2 == 0 and modulus1 == modulus2: - return True - else: - return False + return bool(rc1 == 0 and rc2 == 0 and modulus1 == modulus2) def generate_rsa_keypair(numbits=1024): -- 2.30.2