Fix errors found by Pylint-2.4.3

New Pylint (2.4.3) catches several new 'true problems'. At the same
time, it warns about things that are massively and reasonably
employed in FreeIPA.

list of fixed:
- no-else-continue
- redeclared-assigned-name
- no-else-break
- unnecessary-comprehension
- using-constant-test (false positive)

list of ignored (responsibility of contributors and reviewers):
- import-outside-toplevel

Fixes: https://pagure.io/freeipa/issue/8102
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Stanislav Levin
2019-10-18 22:56:47 +03:00
committed by Fraser Tweedale
parent f44b73b97c
commit c6769ad12f
19 changed files with 26 additions and 40 deletions

View File

@@ -1372,9 +1372,8 @@ def wait_for_cleanallruv_tasks(ldap, timeout=30):
):
logger.debug("All cleanallruv tasks finished successfully")
break
else:
logger.debug("cleanallruv task in progress, (waited %s/%ss)",
i, timeout)
logger.debug("cleanallruv task in progress, (waited %s/%ss)",
i, timeout)
time.sleep(1)
else:
logger.error('Giving up waiting for cleanallruv to finish')

View File

@@ -130,11 +130,11 @@ class CALessBase(IntegrationTest):
cls.cert_password = cls.master.config.admin_password
cls.crl_path = os.path.join(cls.master.config.test_dir, 'crl')
if cls.replicas:
if cls.replicas: # pylint: disable=using-constant-test
replica_hostname = cls.replicas[0].hostname
else:
replica_hostname = 'unused-replica.test'
if cls.clients:
if cls.clients: # pylint: disable=using-constant-test
client_hostname = cls.clients[0].hostname
else:
client_hostname = 'unused-client.test'

View File

@@ -39,9 +39,9 @@ def ipatestdir(testdir):
"nslices,nslices_d,groups",
[(2, 0, [[x for x in range(MODS_NUM) if x % 2 == 0],
[x for x in range(MODS_NUM) if x % 2 != 0]]),
(2, 1, [[0], [x for x in range(1, MODS_NUM)]]),
(1, 0, [[x for x in range(MODS_NUM)]]),
(1, 1, [[x for x in range(MODS_NUM)]]),
(2, 1, [[0], list(range(1, MODS_NUM))]),
(1, 0, [list(range(MODS_NUM))]),
(1, 1, [list(range(MODS_NUM))]),
(MODS_NUM, MODS_NUM, [[x] for x in range(MODS_NUM)]),
])
def test_slicing(ipatestdir, nslices, nslices_d, groups):

View File

@@ -206,7 +206,7 @@ def certmap_user(request):
def addcertmap_id(options):
if options:
return u', '.join([k for k in options])
return u', '.join(list(options))
else:
return u' '