From f45a389586bdb2eaa2f2424d3b97c4dae22dec46 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 14 Jun 2023 09:54:48 +0200 Subject: [PATCH] Make the linter happy with lib/pp_admintools/config/mirror_ldap.py --- lib/pp_admintools/config/mirror_ldap.py | 27 +++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lib/pp_admintools/config/mirror_ldap.py b/lib/pp_admintools/config/mirror_ldap.py index 8ff5c6e..539b075 100644 --- a/lib/pp_admintools/config/mirror_ldap.py +++ b/lib/pp_admintools/config/mirror_ldap.py @@ -10,10 +10,9 @@ from __future__ import absolute_import # Standard module +# import copy import logging import re -# import copy - from collections.abc import Mapping # Third party modules @@ -21,14 +20,12 @@ from fb_tools.common import is_sequence from fb_tools.multi_config import DEFAULT_ENCODING # Own modules +from .ldap import LdapConfigError, LdapConfiguration from .. import DEFAULT_CONFIG_DIR from .. import pp - -from .ldap import LdapConfigError, LdapConfiguration - from ..xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -57,7 +54,7 @@ class MirrorLdapConfiguration(LdapConfiguration): append_appname_to_stems=True, additional_stems=None, config_dir=DEFAULT_CONFIG_DIR, additional_config_file=None, additional_cfgdirs=None, encoding=DEFAULT_ENCODING, ensure_privacy=False, use_chardet=True, initialized=False): - + """Initialize the MirrorLdapConfiguration object.""" self.entries_keep = {} self.transform = {} @@ -84,11 +81,11 @@ class MirrorLdapConfiguration(LdapConfiguration): # ------------------------------------------------------------------------- def eval_section(self, section_name): - + """Evaluate a particular configuration section.""" sn = section_name.lower() if self.verbose > 1: - LOG.debug(_("Evaluating configuration section {sn!r} ...").format(sn=sn)) + LOG.debug(_('Evaluating configuration section {sn!r} ...').format(sn=sn)) super(MirrorLdapConfiguration, self).eval_section(section_name) @@ -101,10 +98,10 @@ class MirrorLdapConfiguration(LdapConfiguration): section = self.cfg[section_name] if self.verbose > 4: - LOG.debug("Section:\n" + pp(section)) + LOG.debug('Section:\n' + pp(section)) if not isinstance(section, Mapping): - LOG.warning(_("Section {sn!r} is not a {what}.").format( + LOG.warning(_('Section {sn!r} is not a {what}.').format( sn=section_name, what='Mapping (dict)')) return @@ -124,13 +121,13 @@ class MirrorLdapConfiguration(LdapConfiguration): sn = str(section_name) + '/' + str(sub_section_name) if self.verbose > 2: - LOG.debug(_("Evaluating configuration section {sn!r} ...").format(sn=sn)) + LOG.debug(_('Evaluating configuration section {sn!r} ...').format(sn=sn)) if self.verbose > 2: - LOG.debug("Section:\n" + pp(sub_section)) + LOG.debug('Section:\n' + pp(sub_section)) if not isinstance(sub_section, Mapping): - LOG.warning(_("Section {sn!r} is not a {what}.").format( + LOG.warning(_('Section {sn!r} is not a {what}.').format( sn=sn, what='Mapping (dict)')) return @@ -149,7 +146,7 @@ class MirrorLdapConfiguration(LdapConfiguration): # ============================================================================= -if __name__ == "__main__": +if __name__ == '__main__': pass -- 2.39.5