mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed errors newly exposed by pylint 2.4.0
Newest Pylint introduced additional checks [1]: - import-outside-toplevel [2] > This check warns when modules are imported from places other than a module toplevel, e.g. inside a function or a class. - no-else-continue [3] > These checks highlight unnecessary else and elif blocks after break and continue statements. - unnecessary-comprehension [4] > This check is emitted when pylint finds list-, set- or dict-comprehensions, that are unnecessary and can be rewritten with the list-, set- or dict-constructors. [1] https://github.com/PyCQA/pylint/blob/pylint-2.4.0/doc/whatsnew/2.4.rst [2] https://github.com/PyCQA/pylint/issues/3067 [3] https://github.com/PyCQA/pylint/issues/2327 [4] https://github.com/PyCQA/pylint/issues/2905 Fixes: https://pagure.io/freeipa/issue/8077 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
committed by
Fraser Tweedale
parent
7c7a827c09
commit
d0b420f6dd
@@ -886,8 +886,10 @@ from ipapython.version import VERSION as __version__
|
||||
def _enable_warnings(error=False):
|
||||
"""Enable additional warnings during development
|
||||
"""
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import ctypes
|
||||
import warnings
|
||||
# pylint: enable=import-outside-toplevel
|
||||
|
||||
# get reference to Py_BytesWarningFlag from Python CAPI
|
||||
byteswarnings = ctypes.c_int.in_dll( # pylint: disable=no-member
|
||||
@@ -937,14 +939,23 @@ class API(plugable.API):
|
||||
def packages(self):
|
||||
if self.env.in_server:
|
||||
# pylint: disable=import-error,ipa-forbidden-import
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import ipaserver.plugins
|
||||
# pylint: enable=import-error,ipa-forbidden-import
|
||||
# pylint: enable=import-outside-toplevel
|
||||
result = (
|
||||
ipaserver.plugins,
|
||||
)
|
||||
else:
|
||||
# disables immediately after an else clause
|
||||
# do not work properly:
|
||||
# https://github.com/PyCQA/pylint/issues/872
|
||||
# Thus, below line was added as a workaround
|
||||
result = None
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import ipaclient.remote_plugins
|
||||
import ipaclient.plugins
|
||||
# pylint: enable=import-outside-toplevel
|
||||
result = (
|
||||
ipaclient.remote_plugins.get_package(self),
|
||||
ipaclient.plugins,
|
||||
@@ -952,8 +963,10 @@ class API(plugable.API):
|
||||
|
||||
if self.env.context in ('installer', 'updates'):
|
||||
# pylint: disable=import-error,ipa-forbidden-import
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import ipaserver.install.plugins
|
||||
# pylint: enable=import-error,ipa-forbidden-import
|
||||
# pylint: enable=import-outside-toplevel
|
||||
result += (ipaserver.install.plugins,)
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user