pylint: remove useless suppression

The newer version of pylint has fixed false positives and
does not need anymore these suppressions:
- global-variable-not-assigned
- invalid-sequence-index
- no-name-in-module
- not-callable
- unsupported-assignment-operation

Related: https://pagure.io/freeipa/issue/9278
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Stanislav Levin <slev@altlinux.org>
This commit is contained in:
Florence Blanc-Renaud 2022-11-18 16:45:25 +01:00
parent fd21204559
commit 51e0f751e9
7 changed files with 4 additions and 12 deletions

View File

@ -57,7 +57,7 @@ KEYTAB_FB = paths.IPA_DNSKEYSYNCD_KEYTAB
def commenceShutdown(signum, stack):
# Declare the needed global variables
global watcher_running
global ldap_connection # pylint: disable=global-variable-not-assigned
global ldap_connection
logger.info('Signal %s received: Shutting down!', signum)

View File

@ -132,7 +132,6 @@ def main():
print("Enabling plugin")
# https://github.com/PyCQA/pylint/issues/872
# pylint: disable=unsupported-assignment-operation
if entry is None:
ld = LDAPUpdate()
if not ld.update(files):
@ -141,7 +140,6 @@ def main():
else:
entry['nsslapd-pluginenabled'] = ['on']
api.Backend.ldap2.update_entry(entry)
# pylint: enable=unsupported-assignment-operation
except errors.ExecutionError as lde:
print("An error occurred while talking to the server.")
print(lde)
@ -171,9 +169,7 @@ def main():
else:
print("Disabling plugin")
# pylint: disable=unsupported-assignment-operation
entry['nsslapd-pluginenabled'] = ['off']
# pylint: enable=unsupported-assignment-operation
api.Backend.ldap2.update_entry(entry)
except errors.DatabaseError as dbe:
print("An error occurred while talking to the server.")

View File

@ -155,9 +155,7 @@ def main():
elif entry.get('nsslapd-pluginenabled', [''])[0].lower() == 'off':
print("Enabling plugin")
# Already configured, just enable the plugin
# pylint: disable=unsupported-assignment-operation
entry['nsslapd-pluginenabled'] = ['on']
# pylint: enable=unsupported-assignment-operation
api.Backend.ldap2.update_entry(entry)
else:
print("Plugin already Enabled")

View File

@ -469,7 +469,7 @@ class NameSpace(ReadOnly):
if isinstance(key, str):
return self.__map[key]
if type(key) in (int, slice):
return self.__members[key] # pylint: disable=invalid-sequence-index
return self.__members[key]
raise TypeError(
TYPE_ERROR % ('key', (str, int, slice, 'object with __name__'),
key, type(key))

View File

@ -93,7 +93,6 @@ class OptionHandler:
raise ValueError(typ)
self.seen.add(name)
# pylint: disable=not-callable
if not self.parser.has_option(self.section, name):
if default is REQUIRED:
raise NameError(self.section, name)
@ -103,7 +102,6 @@ class OptionHandler:
# the default, e.g. pw_uid with default='root' returns 0.
return handler(self.section, name, default)
# pylint: enable=not-callable
def check_surplus(self):
surplus = []

View File

@ -32,7 +32,7 @@ import os
import fnmatch
import warnings
from pysss_murmur import murmurhash3 # pylint: disable=no-name-in-module
from pysss_murmur import murmurhash3
import six
from ipapython import ipautil, ipaldap

View File

@ -2,7 +2,7 @@
from collections import namedtuple
from io import BytesIO
from lxml.etree import parse as myparse # pylint: disable=no-name-in-module
from lxml.etree import parse as myparse
import pytest
import textwrap
from unittest.mock import mock_open, patch