Fix Custodia pylint issues

See: https://pagure.io/freeipa/issue/8882
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Christian Heimes 2021-06-11 08:43:23 +02:00 committed by Rob Crittenden
parent a4631b7f3f
commit e1abfe0fb7
10 changed files with 16 additions and 17 deletions

View File

@ -62,7 +62,7 @@ class HTTPUnixAdapter(HTTPAdapter):
DEFAULT_HEADERS = {'Content-Type': 'application/json'}
class CustodiaHTTPClient(object):
class CustodiaHTTPClient:
timeout = None # seconds (float)
def __init__(self, url):

View File

@ -42,7 +42,7 @@ class SimplePathAuthz(HTTPAuthorizer):
if path == '/':
path = ''
else:
path, _ = os.path.split(path)
path, _head = os.path.split(path)
self.logger.debug('No path in %s matched %s', self.paths, reqpath)
return None

View File

@ -492,7 +492,7 @@ class HTTPRequestHandler(BaseHTTPRequestHandler):
raise HTTPError(404)
class HTTPServer(object):
class HTTPServer:
handler = HTTPRequestHandler
def __init__(self, srvurl, config):

View File

@ -158,7 +158,7 @@ AUDIT_MESSAGES = [
]
class AuditLog(object):
class AuditLog:
def __init__(self, logger):
self.logger = logger

View File

@ -39,7 +39,7 @@ class UnallowedMessage(Exception):
super(UnallowedMessage, self).__init__(message)
class MessageHandler(object):
class MessageHandler:
def __init__(self, request):
self.req = request

View File

@ -14,7 +14,7 @@ key_types = {'simple': SimpleKey,
'kem': KEMHandler}
class Validator(object):
class Validator:
"""Validates incoming messages."""
def __init__(self, allowed=None):

View File

@ -200,7 +200,7 @@ class KEMHandler(MessageHandler):
return {'type': 'kem', 'value': value}
class KEMClient(object):
class KEMClient:
def __init__(self, server_keys, client_keys):
self.server_keys = server_keys

View File

@ -20,14 +20,14 @@ from .log import CustodiaLoggingAdapter, auditlog, getLogger
logger = getLogger(__name__)
class _Required(object):
class _Required:
__slots__ = ()
def __repr__(self):
return 'REQUIRED'
class INHERIT_GLOBAL(object): # noqa: N801
class INHERIT_GLOBAL: # noqa: N801
__slots__ = ('default',)
def __init__(self, default):
@ -68,7 +68,7 @@ class CSStoreDenied(CustodiaException):
pass
class OptionHandler(object):
class OptionHandler:
"""Handler and parser for plugin options
"""
def __init__(self, parser, section):
@ -108,7 +108,7 @@ class OptionHandler(object):
def check_surplus(self):
surplus = []
for name, _ in self.parser.items(self.section):
for name, _value in self.parser.items(self.section):
if (name not in self.seen and not
self.parser.has_option(configparser.DEFAULTSECT, name)):
surplus.append(name)
@ -190,7 +190,7 @@ class OptionHandler(object):
return json.loads(value)
class PluginOption(object):
class PluginOption:
"""Plugin option
code::
@ -293,7 +293,7 @@ class CustodiaPluginMeta(abc.ABCMeta):
@six.add_metaclass(CustodiaPluginMeta)
class CustodiaPlugin(object):
class CustodiaPlugin:
"""Abstract base class for all Custodia plugins
"""
_options = ()

View File

@ -114,10 +114,9 @@ class Secrets(HTTPConsumer):
for t in types:
if t.strip() == 'application/json':
binary = False
break
elif t.strip() == 'application/octet-stream':
binary = True
if binary is True:
if binary:
response['headers'][
'Content-Type'] = 'application/octet-stream'
response['output'] = b64decode(reply['value'])

View File

@ -11,7 +11,7 @@ from ipaserver.custodia.compat import configparser
from ipaserver.custodia.compat import url_escape
class CustodiaConfig(object):
class CustodiaConfig:
CONFIG_SPECIALS = ['authenticators', 'authorizers', 'consumers', 'stores']
DEFAULT_PATHS = [
@ -86,7 +86,7 @@ class CustodiaConfig(object):
return configfiles
def makedirs(self):
for name, _ in self.DEFAULT_PATHS:
for name, _path in self.DEFAULT_PATHS:
path = self.parser.get(u'DEFAULT', name)
parent = os.path.dirname(path)
# create parents according to umask